Read Recent updates afresh on every opening before marking them seen
CI / ci (push) Successful in 9m18s
CI / ci (pull_request) Successful in 10m3s

gcTime 0 only schedules removal of the cached list, so an immediate
reopen within the query client's staleTime reused it and marked the old
newest time seen. useUpdates now refetches on every mount, and the sheet
shows and marks seen only a list read after it opened.

Closes MQ-176-01.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-10 14:17:07 -04:00
co-authored by Claude Opus 5.5
parent 9978e200e6
commit 6956f6f049
3 changed files with 65 additions and 6 deletions
+4 -4
View File
@@ -144,16 +144,16 @@ export function parseUpdates(where: string, body: unknown, origin: string): Upda
}
// useUpdates is the Recent updates (GET /api/v1/updates): the last ten
// notification events, newest first. The list is dropped as soon as the
// sheet showing it closes (gcTime 0), so each opening reads it afresh and
// never shows, or marks seen, a list read before an event stored since.
// notification events, newest first. Each opening of the sheet reads it
// afresh (refetchOnMount 'always'), whatever the query client still holds;
// the sheet shows, and marks seen, only the list that opening read.
export function useUpdates() {
const { apiFetch } = useApi()
return useQuery({
queryKey: UPDATES_KEY,
queryFn: async () =>
parseUpdates(`GET ${UPDATES_PATH}`, await apiFetch<unknown>(UPDATES_PATH), window.location.origin),
gcTime: 0,
refetchOnMount: 'always',
})
}