Skip to content

Commit d91e928

Browse files
committed
refactor: filter triggers
Signed-off-by: Adam Setch <[email protected]>
1 parent 489a865 commit d91e928

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/renderer/context/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
158158
setNightScheme(colorScheme ?? DEFAULT_NIGHT_COLOR_SCHEME);
159159
}, [settings.theme, setColorMode, setDayScheme, setNightScheme]);
160160

161-
// biome-ignore lint/correctness/useExhaustiveDependencies: We only want fetchNotifications to be called for account changes
161+
// biome-ignore lint/correctness/useExhaustiveDependencies: We only want fetchNotifications to be called for particular state changes
162162
useEffect(() => {
163163
fetchNotifications({ auth, settings });
164-
}, [auth.accounts]);
164+
}, [auth.accounts, settings.filterReasons, settings.hideBots]);
165165

166166
useInterval(() => {
167167
fetchNotifications({ auth, settings });

src/renderer/routes/Filters.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const FiltersRoute: FC = () => {
3535
updateSetting('filterReasons', reasons);
3636
};
3737

38-
const shouldShowReason = (reason: Reason) => {
38+
const isReasonFilterSet = (reason: Reason) => {
3939
return settings.filterReasons.includes(reason);
4040
};
4141

@@ -86,7 +86,7 @@ export const FiltersRoute: FC = () => {
8686
<Stack direction="vertical" gap="condensed">
8787
{Object.keys(FORMATTED_REASONS).map((reason: Reason) => {
8888
const reasonTitle = formatReason(reason).title;
89-
const reasonChecked = shouldShowReason(reason);
89+
const isReasonChecked = isReasonFilterSet(reason);
9090
const reasonDescription = formatReason(reason).description;
9191
const reasonCount = getReasonFilterCount(notifications, reason);
9292

@@ -95,7 +95,7 @@ export const FiltersRoute: FC = () => {
9595
key={reason}
9696
name={reason}
9797
label={reasonTitle}
98-
checked={reasonChecked}
98+
checked={isReasonChecked}
9999
onChange={(evt) =>
100100
updateReasonFilter(reason, evt.target.checked)
101101
}

0 commit comments

Comments
 (0)