Skip to content
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

skip immediate revalidation when initalData is provided #211

Merged
merged 1 commit into from
Dec 22, 2019

Conversation

addstar34
Copy link
Contributor

This fixes #194.

I wasn't sure if this should be set via another option or not but if so let me know and I can update.

Copy link
Member

@shuding shuding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! The change looks good to me and it's reasonable to enable this by default.

@iamstarkov
Copy link

@addstar34 do you think this PR could introduce a regression i described in #230 ?

@andreoav
Copy link

After upgrading, if I set the initialData options, SWR does not send the request.
I'm not using with SSR. It is a CRA application.

aj-may added a commit to aj-may/swr that referenced this pull request May 12, 2020
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
@aj-may aj-may mentioned this pull request May 12, 2020
aj-may added a commit to aj-may/swr that referenced this pull request May 22, 2020
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
aj-may added a commit to aj-may/swr that referenced this pull request May 29, 2020
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When using SSR and initialData, is it possible to prevent first validation after render?
4 participants