Repository navigation
Replies: 13 comments 5 replies
|
How is it going with this feature? |
|
Still look forward to this one. |
|
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) ? |
|
For now append const url = `https://sample.com/greet?t=${Date.now()}` |
|
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],
}); |
|
@fhyfhyfhy That looks pretty clever! I will give it a shot, thanks. |
|
You never supported it? |
|
new PR(arguable suggestion) for this issue with |
|
I'm sorry, but 2 years passed, no progress on this feature request? I wonder if I can set It's VERY Useful. |
|
Any updates? |
|
I found |
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. |
|
ok folks. I'm sharing my workaround. Replace |
Uh oh!
There was an error while loading. Please reload this page.
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
All reactions