Replies: 13 comments 4 replies
-
How is it going with this feature? |
Beta Was this translation helpful? Give feedback.
-
Still look forward to this one. |
Beta Was this translation helpful? Give feedback.
-
I'm surprised to see that there's (apparently?) no way to disable caching. I need to do this for testing / illustrative purposes. In particular I'm trying to simulate slow network fetches and make sure my UI components have appropriate loading states, etc. It's easy for me to simulate the slow network fetch, but Is there any option other than to manually remove cache entries as illustrated in #456 (comment) ? |
Beta Was this translation helpful? Give feedback.
-
For now append const url = `https://sample.com/greet?t=${Date.now()}` |
Beta Was this translation helpful? Give feedback.
-
This is my method, I don't know if it can help you. const disableCache = (useSWRNext) => {
return (key, fetcher, config) => {
const swr = useSWRNext(key, fetcher, config);
const { data, isValidating } = swr;
return Object.assign({}, swr, {
data: isValidating ? undefined : data,
});
};
};
export default (params) =>
useSWR(URL, fetcher, {
focusThrottleInterval: 0,
use: [disableCache],
}); |
Beta Was this translation helpful? Give feedback.
-
@fhyfhyfhy That looks pretty clever! I will give it a shot, thanks. |
Beta Was this translation helpful? Give feedback.
-
You never supported it? |
Beta Was this translation helpful? Give feedback.
-
new PR(arguable suggestion) for this issue with |
Beta Was this translation helpful? Give feedback.
-
I'm sorry, but 2 years passed, no progress on this feature request? I wonder if I can set It's VERY Useful. |
Beta Was this translation helpful? Give feedback.
-
Any updates? |
Beta Was this translation helpful? Give feedback.
-
I found |
Beta Was this translation helpful? Give feedback.
-
I'm trying to find another way and the example above is for But there is one thing I can't figure it out and needs help for understanding. Here I throw a @shuding If you give me some insight, it would be great. |
Beta Was this translation helpful? Give feedback.
-
ok folks. I'm sharing my workaround. Replace |
Beta Was this translation helpful? Give feedback.
-
SWR would't send requests of same key anymore but return the cache of it within stale time
when stale timer expires, SWR would resend request of current page on mounted or when we mutate it manually
Beta Was this translation helpful? Give feedback.
All reactions