Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
/frameworkPublic archive

fix(nuxt): await plugin asyncdata promises in nuxt hook - #9616

Merged
danielroe merged 5 commits into
nuxt:mainfrom
eyurkin:fix/useFetchInServerPlugin
Dec 10, 2022
Merged

fix(nuxt): await plugin asyncdata promises in nuxt hook#9616
danielroe merged 5 commits into
nuxt:mainfrom
eyurkin:fix/useFetchInServerPlugin

Conversation

@eyurkin

@eyurkineyurkin commented Dec 9, 2022

Copy link
Copy Markdown
Contributor

🔗 Linked issue

resolvesnuxt/nuxt#15773

❓ 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)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

Added a check for the presence of currentInstance before calling the vue hook onServerPrefetch

Fix vue warn when calling useFetch in serverPlugin

[Vue warn]: onServerPrefetch is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.

Resolvesnuxt/nuxt#15773

📝 Checklist

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

@codesandbox

Copy link
Copy Markdown

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

@vercel

vercelBot commented Dec 9, 2022

Copy link
Copy Markdown

@eyurkin is attempting to deploy a commit to the Nuxt Team on Vercel.

A member of the Team first needs to authorize it.

Comment threadpackages/nuxt/src/app/composables/asyncData.ts

@danielroedanielroe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we also add a matching test to the fixture?

Comment threadpackages/nuxt/src/app/composables/asyncData.ts
Comment threadpackages/nuxt/src/app/composables/asyncData.ts Outdated
Comment threadpackages/nuxt/src/app/composables/asyncData.ts Outdated
@danielroedanielroe changed the title fix(nuxt): fix vue warn in useFetch (server plugin)fix(nuxt): await plugin asyncdata promises in nuxt hookDec 10, 2022
@danielroe
danielroe merged commit 4641e8e into nuxt:mainDec 10, 2022
@pi0pi0 mentioned this pull request Dec 15, 2022
6 tasks
@danielroedanielroe mentioned this pull request Jan 20, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

useFetch in Nuxt Plugin

3 participants

@eyurkin@pi0@danielroe