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(runtime-utils): pass global directives to mountSuspended #960

Merged
merged 3 commits into from
Oct 3, 2024

Conversation

joel-wenzel
Copy link
Contributor

@joel-wenzel joel-wenzel commented Sep 30, 2024

πŸ”— Linked issue

resolves #959

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • [ x] πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ 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

Custom vue directives, typically added through a nuxt plugin, are not available in the testing environment.

For example the following plugin defines a custom uppercase directive:

export default defineNuxtPlugin(({ vueApp }) => {
  vueApp.directive('uppercase', {
    mounted: (el, binding, node) => {
      // ...impl code
    },
  })
})

However when running tests the below warning can be observed:

[Vue warn]: Failed to resolve directive: uppercase
  at <MountSuspendedComponent >
  at <MountSuspendedHelper>
  at <Anonymous ref="VTU_COMPONENT" >
  at <VTUROOT>
[Vue warn]: Failed to resolve directive: uppercase 
  at <MountSuspendedComponent > 
  at <MountSuspendedHelper> 
  at <Anonymous ref="VTU_COMPONENT" > 
  at <VTUROOT>

Copy link
Member

@danielroe danielroe 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 πŸ™

@danielroe
Copy link
Member

would it be possible to add a test?

@joel-wenzel
Copy link
Contributor Author

would it be possible to add a test?

@danielroe sorry - I looked at adding a test the other day and was running into some issues trying to import mountSuspended

@danielroe danielroe changed the title fix (mount suspended): register directives if any exist fix(runtime-utils): pass global directives to mountSuspended Oct 3, 2024
@danielroe
Copy link
Member

no worries at all!

@danielroe danielroe merged commit 73b8d7a into nuxt:main Oct 3, 2024
4 checks passed
@github-actions github-actions bot mentioned this pull request Oct 3, 2024
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.

MountSuspended should consider any directives added to the vue app
2 participants