We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I use some prefetching technique with mutate() when the user hovers a link
export function HomePage(){ async function prefetch(){ await mutate("/api/data", async (cache?: Data) => { if (cache) return cache return await fetcher<Data>("/api/data") }, false) } return <> <div onMouseEnter={prefetch} onTouchStart={prefetch}> <Link href="/data"> ... </Link> </div> </> } export function DataPage(){ const res = useSWR<Data>("/api/data") console.log(res.isValidating) // true return <> ... </> }
However, when the user clicks too fast, mutate() starts fetching but on the next page isValidating is still true (and never becomes false).
I expect isValidating to be false
[email protected]
The text was updated successfully, but these errors were encountered:
I mean, it's expected to be true for a short moment, but it keeps being true
Sorry, something went wrong.
This doesn't work either:
await mutate(url, (cache?: T) => { if (cache) return cache fetcher(url) .then(data => mutate(url, data, false)) .catch(() => { }) }, false)
After a while it stops and throws a timeout error
repro: https://codesandbox.io/s/simple-prefetch-forked-rsofy
Successfully merging a pull request may close this issue.
Bug report
Description / Observed Behavior
I use some prefetching technique with mutate() when the user hovers a link
However, when the user clicks too fast, mutate() starts fetching but on the next page isValidating is still true (and never becomes false).
Expected Behavior
I expect isValidating to be false
Additional Context
[email protected]
The text was updated successfully, but these errors were encountered: