-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Labels
Milestone
Description
I'm using version: 3.25.1
Please consider this example:
const URL = 'https://randomuser.me/api/?results=5&inc=name';
const Example = () => {
const { error, data, isLoading, refetch } = useQuery('test', () =>
fetch(URL).then(response => response.json()), {
refetchOnWindowFocus: false,
refetchOnReconnect: false,
retry: 1
});
if (isLoading) return <span>Loading...</span>
if (error) return <span>Error: {error.message} <button onClick={refetch}>retry</button></span>
return (
<div>
<ul>
{
data.results.map((item, key) => <li key={key}>{item.name.first} {item.name.last}</li>)
}
</ul>
<button onClick={refetch}>Refetch</button>
</div>
)
}
After use the offline mode by DevTools > Network > Throttling, this component doesn't show the loading or even never stop fetching. It's expected to stop fetching and shows the error after once trying...
But after setting this config: retry: false code works correct and shows the error and retrying button.