Add retry, staleTime, and refetchOnWindowFocus query options#66
Open
KidkArolis wants to merge 1 commit intore-orderfrom
Open
Add retry, staleTime, and refetchOnWindowFocus query options#66KidkArolis wants to merge 1 commit intore-orderfrom
KidkArolis wants to merge 1 commit intore-orderfrom
Conversation
New query configuration options for resilience and freshness control:
- retry: Automatic retry with exponential backoff on fetch failures
(default: 3 retries, 1s→2s→4s... capped at 30s)
- retryDelay: Custom delay function or fixed ms between retries
- staleTime: Time data is considered "fresh" before background refetch
(default: 30s - prevents refetch storms from rapid tab switching)
- refetchOnWindowFocus: Refetch stale queries when window regains focus
(default: true - catches missed realtime events after dormancy)
All options work as global defaults via Figbird constructor:
new Figbird({
adapter,
defaultQueryConfig: {
retry: 3,
staleTime: 60_000,
refetchOnWindowFocus: true,
}
})
Or as per-query overrides:
useFind('messages', { staleTime: 0, retry: false })
The 30s default staleTime balances two concerns:
- Realtime events keep data fresh in normal operation
- Refetch catches edge cases (laptop sleep, background tab throttling)
- Rapid tab switching won't cause refetch storms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New query configuration options for resilience and freshness control:
(default: 3 retries, 1s→2s→4s... capped at 30s)
(default: 30s - prevents refetch storms from rapid tab switching)
(default: true - catches missed realtime events after dormancy)
All options work as global defaults via Figbird constructor:
Or as per-query overrides:
The 30s default staleTime balances two concerns: