diff --git a/src/renderer/components/login/LoginWithPersonalAccessTokenForm.tsx b/src/renderer/components/login/LoginWithPersonalAccessTokenForm.tsx index c535a57f3..e1fe94b4c 100644 --- a/src/renderer/components/login/LoginWithPersonalAccessTokenForm.tsx +++ b/src/renderer/components/login/LoginWithPersonalAccessTokenForm.tsx @@ -150,7 +150,7 @@ export const LoginWithPersonalAccessTokenForm: FC Promise; loginWithOAuthApp: (forge: Forge, data: LoginOAuthWebOptions) => Promise; loginWithPersonalAccessToken: (data: LoginPersonalAccessTokenOptions) => Promise; - logoutFromAccount: (account: Account) => Promise; + logoutFromAccount: (account: Account) => void; } /** @@ -97,7 +97,7 @@ export const useLogins = (): LoginsState => { const existingAccount = accounts.find((a) => a.hostname === hostname && a.method === method); if (existingAccount) { - await removeAccountNotifications(existingAccount); + removeAccountNotifications(existingAccount); } await createAccount(method, token, hostname, forge); @@ -128,9 +128,7 @@ export const useLogins = (): LoginsState => { ); await createAccountInStore(cliAuth.authMethod, '' as Token, hostname, forge); - for (const account of existingAccounts) { - await removeAccountNotifications(account); - } + existingAccounts.forEach((account) => removeAccountNotifications(account)); await queryClient.invalidateQueries({ queryKey: notificationsKeys.all }); }, @@ -154,7 +152,7 @@ export const useLogins = (): LoginsState => { (a) => a.hostname === authOptions.hostname && a.method === 'OAuth App', ); if (existingAccount) { - await removeAccountNotifications(existingAccount); + removeAccountNotifications(existingAccount); } await createAccount('OAuth App', token, authOptions.hostname, forge); @@ -183,7 +181,7 @@ export const useLogins = (): LoginsState => { a.forge === resolvedForge, ); if (existingAccount) { - await removeAccountNotifications(existingAccount); + removeAccountNotifications(existingAccount); } await createAccount('Personal Access Token', token, hostname, resolvedForge, username); @@ -192,8 +190,8 @@ export const useLogins = (): LoginsState => { ); const logoutFromAccount = useCallback( - async (account: Account) => { - await removeAccountNotifications(account); + (account: Account) => { + removeAccountNotifications(account); removeAccount(account); }, diff --git a/src/renderer/hooks/useNotifications.test.tsx b/src/renderer/hooks/useNotifications.test.tsx index dd8e51165..14116b4a4 100644 --- a/src/renderer/hooks/useNotifications.test.tsx +++ b/src/renderer/hooks/useNotifications.test.tsx @@ -790,8 +790,8 @@ describe('renderer/hooks/useNotifications.ts', () => { const enterpriseCount = mockMultipleAccountNotifications[1].notifications.length; - await act(async () => { - await result.current.removeAccountNotifications(mockGitHubCloudAccount); + await act(() => { + result.current.removeAccountNotifications(mockGitHubCloudAccount); }); await waitFor(() => expect(result.current.notificationCount).toBe(enterpriseCount)); diff --git a/src/renderer/hooks/useNotifications.ts b/src/renderer/hooks/useNotifications.ts index 6120252c6..7a2dfd649 100644 --- a/src/renderer/hooks/useNotifications.ts +++ b/src/renderer/hooks/useNotifications.ts @@ -69,7 +69,7 @@ interface NotificationsState { hasUnreadNotifications: boolean; refetchNotifications: () => Promise; - removeAccountNotifications: (account: Account) => Promise; + removeAccountNotifications: (account: Account) => void; markNotificationsAsRead: (notifications: GitifyNotification[]) => Promise; markNotificationsAsDone: (notifications: GitifyNotification[]) => Promise; @@ -305,7 +305,7 @@ export const useNotifications = ({ }, [withSideEffects, fetchIntervalMs, refetch]); const removeAccountNotifications = useCallback( - async (account: Account) => { + (account: Account) => { const accountUUID = getAccountUUID(account); queryClient.setQueryData( diff --git a/src/renderer/routes/github/LoginWithOAuthApp.tsx b/src/renderer/routes/github/LoginWithOAuthApp.tsx index cef705ebb..02d7b0fbe 100644 --- a/src/renderer/routes/github/LoginWithOAuthApp.tsx +++ b/src/renderer/routes/github/LoginWithOAuthApp.tsx @@ -89,7 +89,7 @@ export const GitHubLoginWithOAuthAppRoute: FC = () => { setErrors(newErrors); if (!newErrors.hostname && !newErrors.clientId && !newErrors.clientSecret) { - verifyLoginCredentials(formData); + await verifyLoginCredentials(formData); } setIsVerifyingCredentials(false); }; diff --git a/src/renderer/utils/forges/github/handlers/checkSuite.ts b/src/renderer/utils/forges/github/handlers/checkSuite.ts index 475048b29..7b475785b 100644 --- a/src/renderer/utils/forges/github/handlers/checkSuite.ts +++ b/src/renderer/utils/forges/github/handlers/checkSuite.ts @@ -23,7 +23,7 @@ export interface CheckSuiteAttributes { } class CheckSuiteHandler extends DefaultHandler { - override async enrich(notification: GitifyNotification): Promise> { + override enrich(notification: GitifyNotification): Partial { const state = getCheckSuiteAttributes(notification)?.status; if (state) { diff --git a/src/renderer/utils/forges/github/handlers/default.ts b/src/renderer/utils/forges/github/handlers/default.ts index 3c2ff5269..075d5a63c 100644 --- a/src/renderer/utils/forges/github/handlers/default.ts +++ b/src/renderer/utils/forges/github/handlers/default.ts @@ -15,7 +15,9 @@ import type { NotificationTypeHandler } from './types'; export class DefaultHandler implements NotificationTypeHandler { supportsMergedQueryEnrichment = false; - async enrich(_notification: GitifyNotification): Promise> { + enrich( + _notification: GitifyNotification, + ): Partial | Promise> { return {}; } diff --git a/src/renderer/utils/forges/github/handlers/types.ts b/src/renderer/utils/forges/github/handlers/types.ts index a922c7c9f..8755326dd 100644 --- a/src/renderer/utils/forges/github/handlers/types.ts +++ b/src/renderer/utils/forges/github/handlers/types.ts @@ -25,7 +25,7 @@ export interface NotificationTypeHandler { enrich( notification: RawGitifyNotification, fetchedData?: unknown, - ): Promise>; + ): Partial | Promise>; /** * Return the icon component for this notification type. diff --git a/src/renderer/utils/forges/github/handlers/workflowRun.ts b/src/renderer/utils/forges/github/handlers/workflowRun.ts index c5efaa1cd..284d8d10b 100644 --- a/src/renderer/utils/forges/github/handlers/workflowRun.ts +++ b/src/renderer/utils/forges/github/handlers/workflowRun.ts @@ -20,7 +20,7 @@ export interface WorkflowRunAttributes { } class WorkflowRunHandler extends DefaultHandler { - override async enrich(notification: GitifyNotification): Promise> { + override enrich(notification: GitifyNotification): Partial { const state = getWorkflowRunAttributes(notification)?.status; if (state) {