summaryrefslogtreecommitdiff
path: root/apps/web/lib/queries
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-02-09 23:24:17 -0800
committerFuwn <[email protected]>2026-02-09 23:24:17 -0800
commit77d239084b85b82bac9e7c7910230351f07078bb (patch)
tree340bb8c2109f5c4261b15b6146f8ce75ab7d4f8f /apps/web/lib/queries
parentfeat: offline support tier 2 — prefetch entry content and SW runtime caching (diff)
downloadasa.news-77d239084b85b82bac9e7c7910230351f07078bb.tar.xz
asa.news-77d239084b85b82bac9e7c7910230351f07078bb.zip
feat: offline support tier 3 — mutation queue and image caching
Paused mutations (read/save toggles) are now persisted to IndexedDB and automatically resumed on reconnection or page reload via TanStack Query's offlineFirst networkMode. Service worker caches images with CacheFirst strategy (500 entries, 7-day expiry) for offline reading.
Diffstat (limited to 'apps/web/lib/queries')
-rw-r--r--apps/web/lib/queries/use-entry-state-mutations.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/apps/web/lib/queries/use-entry-state-mutations.ts b/apps/web/lib/queries/use-entry-state-mutations.ts
index 80bab79..b5f64e9 100644
--- a/apps/web/lib/queries/use-entry-state-mutations.ts
+++ b/apps/web/lib/queries/use-entry-state-mutations.ts
@@ -3,6 +3,7 @@
import { useMutation, useQueryClient } from "@tanstack/react-query"
import { createSupabaseBrowserClient } from "@/lib/supabase/client"
import { queryKeys } from "./query-keys"
+import { MUTATION_KEYS } from "@/lib/query-client"
import type { TimelineEntry } from "@/lib/types/timeline"
import type { InfiniteData } from "@tanstack/react-query"
@@ -11,6 +12,7 @@ export function useToggleEntryReadState() {
const queryClient = useQueryClient()
return useMutation({
+ mutationKey: MUTATION_KEYS.toggleEntryReadState,
mutationFn: async ({
entryIdentifier,
isRead,
@@ -84,6 +86,7 @@ export function useToggleEntrySavedState() {
const queryClient = useQueryClient()
return useMutation({
+ mutationKey: MUTATION_KEYS.toggleEntrySavedState,
mutationFn: async ({
entryIdentifier,
isSaved,