fix(sw): network-first + 3s timeout statt SWR fuer Daten
All checks were successful
Build & Publish Docker Image / build-and-push (push) Successful in 30s
All checks were successful
Build & Publish Docker Image / build-and-push (push) Successful in 30s
SWR lieferte bei jedem Cache-Hit sofort die alte Antwort und aktualisierte das Cache nur fuer den naechsten Request. Folge: UI zeigte stale Daten, frische Daten erst nach Refresh. Neu: network-first mit 3 s Timeout-Fallback. Netz gewinnt bei frischer Antwort; Timeout oder Netzwerk-Fehler fallen auf Cache zurueck. Pre-Cache-Logik (runSync) bleibt unveraendert, Shell und Bilder bleiben cache-first.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
export type CacheStrategy = 'shell' | 'swr' | 'images' | 'network-only';
|
||||
export type CacheStrategy = 'shell' | 'network-first' | 'images' | 'network-only';
|
||||
|
||||
type RequestShape = { url: string; method: string };
|
||||
|
||||
@@ -37,6 +37,7 @@ export function resolveStrategy(req: RequestShape): CacheStrategy {
|
||||
return 'shell';
|
||||
}
|
||||
|
||||
// Everything else: recipe pages, API reads, lists — all SWR.
|
||||
return 'swr';
|
||||
// Everything else: recipe pages, API reads, lists — network-first with
|
||||
// timeout fallback to cache (handled in service-worker.ts).
|
||||
return 'network-first';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user