-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
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
0.1.15-beta.0 regression in ssr with initialData: staleness thing doesnt refetch. works fine in 0.1.15 #230
Comments
the problem is that in
workaround in the meantime: const useFixedSWR = (key, fetcher, {initialData, ...config} = {}) => {
const initial = React.useRef(initialData);
React.useEffect(() => {
if(key){
initial.current = undefined;
}
}, [key]);
return useSWR(key, fetcher, {...config, initialData: initial.current});
} |
the problem doesnt exist in
|
Looks like regression was introduced in
|
this is the diff 0.1.15...v0.1.15-beta.0 |
It appears some time ago the `initialData` configuration was used as a fallback. When vercel#211 was merged, this behavior changed to be used with SSR like in the next.js example in the README. Issue vercel#230 explains this was the expectation. I'm using SSR, so im fine with the new behavior. Since `initialData` is now not quickly revalidated, another issue (vercel#308) has been raised. Since `initialData` is not cached, and the mutate w/ callback grabs the curerent data from the cache, when `initialData` is used, `undefined` is returned. fixes vercel#308
It appears some time ago the `initialData` configuration was used as a fallback. When vercel#211 was merged, this behavior changed to be used with SSR like in the next.js example in the README. Issue vercel#230 explains this was the expectation. I'm using SSR, so im fine with the new behavior. Since `initialData` is now not quickly revalidated, another issue (vercel#308) has been raised. Since `initialData` is not cached, and the mutate w/ callback grabs the curerent data from the cache, when `initialData` is used, `undefined` is returned. fixes vercel#308
It appears some time ago the `initialData` configuration was used as a fallback. When vercel#211 was merged, this behavior changed to be used with SSR like in the next.js example in the README. Issue vercel#230 explains this was the expectation. I'm using SSR, so im fine with the new behavior. Since `initialData` is now not quickly revalidated, another issue (vercel#308) has been raised. Since `initialData` is not cached, and the mutate w/ callback grabs the curerent data from the cache, when `initialData` is used, `undefined` is returned. fixes vercel#308
I think this issue is not well formatted and described. It might make sense to open a new one with a concise description and not clutter it with references. |
I dont agree that is "not well formatted and described". Following sentence describes the problem perfectly:
in regards to reference, I dont control em |
could you try the solution posted in #284 (comment) ? |
as described, will add a demo asap
The text was updated successfully, but these errors were encountered: