summaryrefslogtreecommitdiff
path: root/apps/web/lib/queries/use-entry-state-mutations.ts
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-02-10 20:33:11 -0800
committerFuwn <[email protected]>2026-02-10 20:33:11 -0800
commit40592fe37310837ad4d6e6f9be76de17e9a33027 (patch)
tree58bfafe8de39a7555e9160ad1224e275b4a8ec71 /apps/web/lib/queries/use-entry-state-mutations.ts
parentfix: let display density apply to main content panel (diff)
downloadasa.news-40592fe37310837ad4d6e6f9be76de17e9a33027.tar.xz
asa.news-40592fe37310837ad4d6e6f9be76de17e9a33027.zip
fix: query entry state directly instead of relying on unfiltered timeline
The detail panel called useTimeline() with no args, creating a separate cache from the entry list's filtered query. Entries not in the first 50 of the global timeline had isSaved/isRead stuck at false.
Diffstat (limited to 'apps/web/lib/queries/use-entry-state-mutations.ts')
-rw-r--r--apps/web/lib/queries/use-entry-state-mutations.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/web/lib/queries/use-entry-state-mutations.ts b/apps/web/lib/queries/use-entry-state-mutations.ts
index b5f64e9..e0c3cc8 100644
--- a/apps/web/lib/queries/use-entry-state-mutations.ts
+++ b/apps/web/lib/queries/use-entry-state-mutations.ts
@@ -74,9 +74,12 @@ export function useToggleEntryReadState() {
}
}
},
- onSettled: () => {
+ onSettled: (_data, _error, variables) => {
queryClient.invalidateQueries({ queryKey: queryKeys.timeline.all })
queryClient.invalidateQueries({ queryKey: queryKeys.savedEntries.all })
+ queryClient.invalidateQueries({
+ queryKey: queryKeys.entryState.single(variables.entryIdentifier),
+ })
},
})
}
@@ -148,9 +151,12 @@ export function useToggleEntrySavedState() {
}
}
},
- onSettled: () => {
+ onSettled: (_data, _error, variables) => {
queryClient.invalidateQueries({ queryKey: queryKeys.timeline.all })
queryClient.invalidateQueries({ queryKey: queryKeys.savedEntries.all })
+ queryClient.invalidateQueries({
+ queryKey: queryKeys.entryState.single(variables.entryIdentifier),
+ })
},
})
}