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
Layout slots not working in default layout #15158
Comments
Unfortunately this isn't valid vue and the only way to use custom slots is with |
@danielroe would it at least be possible to avoid re-rendering the layout if it stays the same, like in the 'this works' case? |
That is absolutely something on my list, and currently pending vuejs/core#6736. (It's not currently possible due to vue behaviour, but should be once that PR merges.) |
Amazing, thanks 🙏🏽 I think that is a feasible workaround. |
Just to add to this, I think it makes some sense as an enhancement. A simple use case would be to have a layout where the screen is split in half, with a slot for each side, and in each page would pass different data to each slot. For example, login / signup pages often follow the same layout but might have different forms on the screen, along with different texts and information. |
Could it be implemented with an additional Nuxt component, something like: |
@danielroe I can see that layout still re-renders even if it's the same layout, is there any workaround for this yet? |
@lubomirblazekcz Would you open a new issue with a reproduction? |
Environment
Nuxt 3.0.0-rc.11
Reproduction
StackBlitz: https://stackblitz.com/edit/nuxt3-layout-slot-bug
Describe the bug
Layout slots not working with default layout, generate error (see reproduction):
Note the use of
app.vue
.Explicitly using
<NuxtLayout>
withlayout: false
in page meta works but leads to full re-render of the layout and kinda defies the purpose of a default layout.Not sure if I'm doing something wrong with the setup, but following the docs, the code in the repro should work. Also, best in terms of DX IMO.
Additional context
This is a typical use case where you for instance have a nav and want to add additional items via a slot on specific pages.
Logs
No response
The text was updated successfully, but these errors were encountered: