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

fix(nuxt): don't refresh when hydrating when data is present #20916

Merged
merged 4 commits into from May 17, 2023

Conversation

danielroe
Copy link
Member

πŸ”— Linked issue

resolves #20900

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

It's an edge case, but when calling execute or refresh we will force refresh data on initial load of a component (ie. when hydrating), because we don't pass the { _initial: true } option by default.

This PR updates behaviour to default to skipping refresh of data if it exists in payload and we're hydrating. It can still be overridden by passing { _initial: false }. I don't regard this as a breaking change as changing data in the payload will almost always be incorrect and cause a hydration failure.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

makes sense

@danielroe danielroe changed the title fix(nuxt): ignore refresh calls when hydrating (if data is present) fix(nuxt): don't refresh when hydrating when data is present May 17, 2023
@danielroe danielroe merged commit 2cdc22a into main May 17, 2023
19 checks passed
@danielroe danielroe deleted the fix/initial-refresh-data branch May 17, 2023 13:23
This was referenced May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

useAsyncData with immediate false and call execute after makes fetching the data twice
2 participants