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

Warning for NuxtPage absence is always shown if setPageLayout is called in middleware #25617

Closed
NozomuIkuta opened this issue Feb 5, 2024 · 6 comments

Comments

@NozomuIkuta
Copy link
Contributor

NozomuIkuta commented Feb 5, 2024

Environment

  • Operating System: Darwin
  • Node Version: v21.5.0
  • Nuxt Version: 3.10.0
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: npm@10.2.4
  • Builder: -
  • User Config: devtools
  • Runtime Modules: -
  • Build Modules: -

But I believe this bug happens in all environments.

Reproduction

Original reproduction by @robert-gruner
https://stackblitz.com/~/edit/github-wgg4gm-sdfzwd

Minimal reproduction by me
https://stackblitz.com/edit/github-wgg4gm-8hhehw

Describe the bug

This issue is an edge case which was not tested in #25490.

With the content.global.ts, which dynamically changes layout, the warning message is always shown.
Without the middleware (i.e. without calling setPageLayout), the warning message is shown expectedly.

Additional context

This issue and the reproduction were originally reported by @robert-gruner as #25490 (comment).

Logs

No response

Copy link

stackblitz bot commented Feb 5, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@danielroe
Copy link
Member

Checking, this looks correct to me. Neither of those layouts has a <slot />, and <NuxtPage /> is not being rendered in either case.

@NozomuIkuta
Copy link
Contributor Author

Neither of those layouts has a , and is not being rendered in either case.

Ah, I overlooked that point!

Here is the fixed version of the reproduction, and yes the warning is not shown with <slot />.
And now calling setPageLayout() doesn't affect this behavior.

https://stackblitz.com/edit/github-wgg4gm-qyvjee

I believe this issue can be closed for now 👍

@robert-gruner

You might want to add <slot /> to the layout components in which <NuxtPage /> is rendered.

@robert-gruner
Copy link

robert-gruner commented Feb 5, 2024

Thanks for the clarification. I can confirm that the warning disappears if we have proper Slots inside the layouts. Sorry for missing that. 🙈

EDIT: Issue can be closed - I think I cannot close it, right? Anyways thanks and keep up the good work!

@NozomuIkuta
Copy link
Contributor Author

@danielroe

For the repository governance, I will leave the closing operation to you 🙋‍♂️

@danielroe danielroe closed this as not planned Won't fix, can't repro, duplicate, stale Feb 5, 2024
@danielroe
Copy link
Member

Thank you all for the investigation and faithful reproductions ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants