Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/renderer/context/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,16 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
setNightScheme,
]);

// biome-ignore lint/correctness/useExhaustiveDependencies: We only want fetchNotifications to be called for particular state changes
// biome-ignore lint/correctness/useExhaustiveDependencies: Fetch new notifications when account count or filters change
useEffect(() => {
fetchNotifications({ auth, settings });
}, [
auth.accounts,
settings.filterUserTypes,
auth.accounts.length,
settings.filterIncludeSearchTokens,
settings.filterExcludeSearchTokens,
settings.filterUserTypes,
settings.filterSubjectTypes,
settings.filterStates,
settings.filterReasons,
]);

Expand Down Expand Up @@ -239,18 +241,20 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
const { authCode } = await authGitHub();
const { token } = await getToken(authCode);
const hostname = Constants.DEFAULT_AUTH_OPTIONS.hostname;

const updatedAuth = await addAccount(auth, 'GitHub App', token, hostname);

setAuth(updatedAuth);
saveState({ auth: updatedAuth, settings });
}, [auth, settings]);

const loginWithOAuthApp = useCallback(
async (data: LoginOAuthAppOptions) => {
const { authOptions, authCode } = await authGitHub(data);

const { token, hostname } = await getToken(authCode, authOptions);

const updatedAuth = await addAccount(auth, 'OAuth App', token, hostname);

setAuth(updatedAuth);
saveState({ auth: updatedAuth, settings });
},
Expand All @@ -268,6 +272,7 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
token,
hostname,
);

setAuth(updatedAuth);
saveState({ auth: updatedAuth, settings });
},
Expand All @@ -279,10 +284,11 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
removeAccountNotifications(account);

const updatedAuth = removeAccount(auth, account);

setAuth(updatedAuth);
saveState({ auth: updatedAuth, settings });
},
[auth, settings],
[auth, settings, removeAccountNotifications],
);

const restoreSettings = useCallback(async () => {
Expand Down