feat(core): staleTime: 'static' (#9139)
* feat(core): StaleTime.Static * fix: consider StaleTime.Static for invalidation previously, it didn't matter if we included `stale: true` or not in the filters for refetch, because marking things with query.invalidate() would set them all to stale anyway. Now, queries with StaleTime.Static will be marked as `invalidated`, but still shouldn't be refetched. The `isStale` filter logic accounts for that, so we have to include it in the filters * fix: isStale order check check for observers first because they contain the source of truth calculated with `isStaleByTime`, and it also takes enabled into account * fix: isStaleByTime logic we have to check for undefined data first, because queries without data are really always stale; then, the next check must be against StaleTime.Static, because queries that are marked as invalidated are still not stale, even if they are static. * tests * fix: type issue in react * fix: make sure invalidation _always_ only refetches stale queries this ensures we never refetch Static queries * fix: never refetch static queries * fix: make sure we don't refetchOn... for StaleTime.Static even when 'always' is set * docs: StaleTime.Static * ref: switch to 'static' string * docs
D
Dominik Dorfmeister committed
b475d2156860243b5c57bf1190919dba67305586
Parent: 34eedd6
Committed by GitHub <noreply@github.com>
on 5/29/2025, 9:40:52 AM