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

feat(nuxt): allow accessing NuxtLayout ref via layoutRef #19465

Merged
merged 14 commits into from Jun 10, 2023

Conversation

huang-julien
Copy link
Member

@huang-julien huang-julien commented Mar 5, 2023

πŸ”— Linked issue

❓ 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

This PR allow the same thing as #19403 but for NuxtLayout : allow using ref .
However this ones use a prop exposed to tranfer data since the LayoutLoader's setup is async.
todo:

  • manual test for memory leaks
  • fix tests

πŸ“ Checklist

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

@codesandbox
Copy link

codesandbox bot commented Mar 5, 2023

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

@huang-julien huang-julien marked this pull request as draft March 5, 2023 16:23
@huang-julien
Copy link
Member Author

huang-julien commented Mar 5, 2023

@danielroe It seems that this also solves another issue. On the current main branch, this line is not triggered
And this test should fail since with-props layout does render a Fragment or multiple root nodes.
I fixed the CI by setting a single root node within with-props.vue, should I add another test to make sure we get a warning if a layout has multiple root nodes (or is this not needed) ?

@huang-julien huang-julien marked this pull request as ready for review March 5, 2023 23:11
@danielroe danielroe mentioned this pull request Mar 8, 2023
@danielroe danielroe requested a review from antfu March 21, 2023 07:41
@danielroe
Copy link
Member

Added a comment here that is also relevant, I think: #19403 (review)

@nuxt-studio
Copy link

nuxt-studio bot commented Jun 10, 2023

βœ… Live Preview ready!

Name Edit Preview Latest Commit
Nuxt Docs Edit on Studio β†—οΈŽ View Live Preview ee661ce

Co-authored-by: Daniel Roe <daniel@roe.dev>
@danielroe danielroe changed the title feat(nuxt): forward layout component ref to NuxtLayout feat(nuxt): allow accessing NuxtLayout ref via layoutRef Jun 10, 2023
@danielroe danielroe merged commit 41d34ca into nuxt:main Jun 10, 2023
23 checks passed
@github-actions github-actions bot mentioned this pull request Jun 10, 2023
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.

None yet

2 participants