How to execute useSWR once and then manually stop the update? #2088
Unanswered
spencerchang
asked this question in
Q&A
Replies: 1 comment
-
Hi! Did you read the documentation? :) If you are trying to use the import useSWRImmutable from 'swr/immutable'
const App = () => {
const { data } = useSWRImmutable(key, fetcher)
return ...
} This approach is the same as manually disabling it like: const { data } = useSWR(key, fetcher, {
revalidateIfStale: false,
revalidateOnFocus: false,
revalidateOnReconnect: false
}) See the docs for more details. If you need to keep data between page refreshes see the local storage based cache. If you are using Next.js, i see one problem with this method here, unresolved still... I hope this helps 😄 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I tried several function such as isPause() and onSuccess() and Conditional Fetching
But after those tries the result is can't show page and component at first.
I expect show the page and component at first and then stop the update when i restart it later.
The implement is like a form to search.
Hope someone can give me some hints
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions