Understanding Fetch States
Every query has two important state properties:status- Reflects the data state:pending,error, orsuccessfetchStatus- Reflects the fetch state:fetching,paused, oridle
A query can be in
success status while fetchStatus is fetching - this means you have data from a previous fetch, but a background refetch is in progress.Primary Loading States
isPending
True when the query has no data yet:isLoading
True when the query is pending AND fetching:Background Fetching Indicators
isFetching
True whenever a fetch is in progress (initial or background):Real-World Example
Complete example showing all states:Global Fetching Indicators
Show a global indicator when any query is fetching:Filtered Global Indicators
Show indicators for specific query types:Visual Feedback Patterns
Inline Background Indicator
Progress Bar
Refresh Indicator with Auto Refetch
Mutation Loading States
Show loading states for mutations:Global Mutation Indicator
Combining States
Complete Loading UX
Best Practices
1
Use isPending for initial loads
Show full loading states (spinners, skeletons) when
isPending is true.2
Use isFetching for background updates
Show subtle indicators (small spinners, progress bars) when
isFetching is true but data exists.3
Provide context-appropriate feedback
Global indicators for app-wide fetching, inline indicators for component-specific updates.
4
Don't over-indicate
Too many loading indicators can be distracting. Choose the most important ones to display.
5
Make indicators non-intrusive
Background refetch indicators should be subtle and not interrupt the user experience.