Refetch triggers and retry are left at TanStack Query defaults
- Vorherrschende Sprache
- TypeScript
- Sterne
- 29
- Forks
- 3
- Ø Merge
- 3 Std. 5 Min.
- Gemergte PRs (30 T.)
- 11
Beschreibung
`NostrApp` sets only `staleTime` and `refetchInterval`
(`src/lib/components/NostrApp.svelte:20-24`):
```ts
const defaultQueryClientConfig = {
defaultOptions: { queries: { staleTime: 1000 * 60, refetchInterval: Infinity } }
};
```
`refetchOnWindowFocus` (TanStack default `true`), `refetchOnMount`,
`refetchOnReconnect` and `retry` (default `3`) are left untouched.
Consequences:
- 60 seconds after a request settles, tabbing back into the app refetches every
visible query. Each refetch re-subscribes the operator chain, which restarts
`scanArray()` / `scanLatestEach()` from their seeds — a timeline of 50 notes
collapses to 1 and slowly regrows. (Filed separately.)
- An exception thrown by an operator produces three re-subscriptions and three
`console.error` lines before the query gives up.
A subscription-backed data source has no notion of "the data went stale and should
be fetched again" in the sense TanStack Query means it, so leaving these at their
HTTP-shaped defaults is not a safe default for this library.
Determined by code reading and by reading the installed `@tanstack/query-core`
defaults; the window-focus path itself was not reproduced.
## Direction
Set explicit defaults for `refetchOnWindowFocus`, `refetchOnMount`,
`refetchOnReconnect` and `retry` in `defaultQueryClientConfig`.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Start in src/lib/components/NostrApp.svelte:20-24 and compare defaultQueryClientConfig with the installed @tanstack/query-core defaults described in the issue. Set explicit values for refetchOnWindowFocus, refetchOnMount, refetchOnReconnect, and retry, then verify the configuration prevents focus, mount, reconnect, and repeated retry refetches for subscription-backed queries.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- frontend
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Ruhig
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 76/100