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): avoid premature hydration when using async layouts #22198

Merged
merged 3 commits into from Jul 19, 2023

Conversation

danielroe
Copy link
Member

@danielroe danielroe commented Jul 18, 2023

πŸ”— Linked issue

resolves #22091
resolves #21999

❓ 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

In #21450, we wrongly removed a workaround for an upstream vue bug (vuejs/core#6638), introducing a regression.

This PR reverts back to the workaround but ultimately we still need to resolve in vue core.

πŸ“ Checklist

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

@stackblitz
Copy link

stackblitz bot commented Jul 18, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@danielroe danielroe requested a review from antfu July 18, 2023 15:08
@danielroe danielroe merged commit 5b409f8 into main Jul 19, 2023
28 checks passed
@danielroe danielroe deleted the fix/layout-hydration branch July 19, 2023 06:55
This was referenced Jul 19, 2023
@gerbenvandijk
Copy link

gerbenvandijk commented Sep 26, 2023

@danielroe This issue still seems present on Nuxt 3.7.1 when you are using a custom error layout (error.vue in the root of the application)

@manniL
Copy link
Member

manniL commented Sep 27, 2023

@gerbenvandijk can you provide a reproduction + opening a new issue? Feel free to link this one in the new issue πŸ‘

@gerbenvandijk
Copy link

@gerbenvandijk can you provide a reproduction + opening a new issue? Feel free to link this one in the new issue πŸ‘

will sort it in the coming week somewhere :) thanks for the quick response!

@gerbenvandijk
Copy link

gerbenvandijk commented Oct 3, 2023

@manniL @danielroe

After setting up a reproduction I was able to resolve it on my end, it had to do with a hydration error that was introduced due to misunderstanding on my end.

I was using the useRequestHeaders() composable in a plugin (to pass some headers to Apollo) not realising that useRequestHeaders() is not available on the client side. After storing the specific header using the useState() composable this problem went away. Thanks anyways for your quick response and apologies :)

Copy link
Member Author

No problem! Glad you resolved it 😊

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.

Top-level await in layout breaks hydration in Nuxt 3.6 custom layout makes useAsyncData run on the client
4 participants