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): async transform for inline middleware #18460

Merged
merged 6 commits into from
Jan 25, 2023
Merged

Conversation

danielroe
Copy link
Member

πŸ”— Linked issue

resolves #18459

❓ 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

We were not transforming inline middleware, meaning that the nuxt instance would be lost after an await.

We might also consider an option to add*Plugin to accept an options argument for unshift/push/etc.

πŸ“ Checklist

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

@codesandbox
Copy link

codesandbox bot commented Jan 23, 2023

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

@antfu
Copy link
Member

antfu commented Jan 24, 2023

I think having options of unshift/push would be great!

@danielroe
Copy link
Member Author

Great - let's do it! For this PR, it doesn't resolve the issue as the unctx plugin needs to be added last; it's not enough to unshift the page-meta plugin, for example.

@danielroe danielroe merged commit 1d68b51 into main Jan 25, 2023
@danielroe danielroe deleted the fix/async-inline-mw branch January 25, 2023 12:52
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.

Using an async method inside an anonymous middleware causes a nuxt instance unavailable
2 participants