You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
useQuery didn't fetch from server at mount time with { fetchPolicy: 'network-only', nextFetchPolicy: 'cache-only' } when React.StrictMode is enabled. #10159
Fetch data from the server at mount time even when React.StrictMode is enabled and useQuery is used with options {fetchPolicy: 'network-only', nextFetchPolicy: 'cache-only'}.
Actual outcome:
Did not fetch on mount.
I think it caused by StrictMode's double-invokes effects behavior. useQuery seems to behaves like below.
mount -> trying to fetch from server
unmount -> cancel fetch
mount -> trying to fetch from cache because of nextFetchPolicy: cache-only
When StrictMode disabled, useQuery fetch from server on mount.
How to reproduce the issue:
Enable the React.StrictMode.
Use useQuery with {fetchPolicy: 'network-only', nextFetchPolicy: 'cache-only'}.