akiomik / akiomik/nosvelte

Refetch triggers and retry are left at TanStack Query defaults

Ouverte Adaptée aux débutants
#75 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
bug
Langage dominant
TypeScript
Étoiles
29
Forks
3
Merge moyen
3 h 5 min
PR mergées (30 j)
11

Description

`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`.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
typescript
Domaine
frontend
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
Calme
Clarté
Clairement spécifiée
Accessibilité débutants
76/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.