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): prefer using currentInstance if available in useNuxtApp #19624

Closed
wants to merge 1 commit into from

Conversation

huang-julien
Copy link
Member

πŸ”— Linked issue

resolve #19623

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 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

hi πŸ‘‹ this is a workaround for #19623

when using useNuxtApp there is a small risk of CRSP with sync server components. However this risk gets higher with async components.
This keeps the current implementation,_ it just prefer using the current instance of the component if it is available.

Needed for #19605

πŸ“ Checklist

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

@codesandbox
Copy link

codesandbox bot commented Mar 12, 2023

CodeSandbox logoCodeSandbox logoΒ  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@huang-julien huang-julien changed the title fix(nuxt): prefer using currentInstance fix(nuxt): prefer using currentInstance if available in useNuxtApp Mar 12, 2023
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.

πŸ‘πŸΌ

@pi0 pi0 self-requested a review March 13, 2023 09:59
@pi0
Copy link
Member

pi0 commented Mar 13, 2023

This seems a nice fix and PR. Only (shared by @danielroe) it seems getCurrentInstance() might suffer from some context leaks as well vuejs/core#7743.

We might try other ideas to mitigate issues with component islands such as using a variable unctx name for island mode

@huang-julien
Copy link
Member Author

So... shall I close this PR then ? πŸ€”
Hoever i'm not very familiar with the usage of unctx.
Tried to implement some tests in #19605 but even fixtures tests are falling into this issue (due to async components)πŸ˜… ...

@huang-julien
Copy link
Member Author

closing as solved by #19753

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.

cross-request state pollution when useAsyncData is used in a plugin
2 participants