Skip to content

fix(nuxt): stop warning about the missing registry without a layout - #29

Merged
KazariEX merged 2 commits into
KazariEX:mainfrom
ExEr7um:fix/no-layout-slots
Aug 27, 2026
Merged

KazariEX merged 2 commits into
KazariEX:mainfrom
ExEr7um:fix/no-layout-slots

Conversation

@ExEr7um

@ExEr7um ExEr7um commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #25: v0.5.7 made rendering a page without a layout work, but Vue still warns on every page.

LayoutSlot and LayoutSlotsForward call inject(injectionKey) with a single argument, and Vue warns whenever the key is missing and no default was passed (it checks arguments.length > 1), so every mounted page logs injection "Symbol(dxup:layout-slots)" not found. useLayoutSlots() a few lines above already passes null.

@KazariEX

KazariEX commented Aug 26, 2026 •

Copy link
Copy Markdown
Owner

I'm not sure if we should do this since normally named slots declared for a layout don't belong to the page itself. Is it possible to consider rendering slots on the page component's parent component when there is no registry? (not sure if it's possible)

@ExEr7um

ExEr7um commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

normally named slots declared for a layout don't belong to the page itself

Fair, I'm not attached to the second commit.

I asked Claude to try your idea. Its findings:

Pushing the named slots onto getCurrentInstance().parent.slots from the forward renders <header>empty</header><main><div>page</div></main> on SSR — the parent renders before the child's setup runs, and SSR is a single pass. On the client it would need a forced re-render of the parent, which then disagrees with the hydrated output; that part is reasoning, not a test.

The registry works because an ancestor provides it and a descendant consumes it, and on the server LayoutSlot can await ready through Suspense. A page's parent is neither, so it would have to implement the registry contract itself — not something RouterView or mountSuspended can be expected to do.

What I'm after is simpler: I want to unit test pages without hand-written wrappers in every spec. This patch may well be the wrong shape for it — it does make the page render markup that isn't its own.

Maybe it belongs in @nuxt/test-utils instead: something that kicks in only when namedLayoutSlots is enabled and mounts a page the way the app renders it, so mountSuspended(Page) matches production on its own.

The first commit is independent of all this — I can keep just that one in this PR and move the slots part to a separate issue.

@KazariEX

Copy link
Copy Markdown
Owner

Yes, just keep the first commit for now.

@ExEr7um
ExEr7um force-pushed the fix/no-layout-slots branch from a88676d to 3c91988 Compare August 26, 2026 16:44
@ExEr7um ExEr7um changed the title fix(nuxt): render named slots and stop warning when there is no layout fix(nuxt): stop warning about the missing registry without a layout Aug 26, 2026
@ExEr7um

ExEr7um commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

Done. I also created issue #30.

@KazariEX
KazariEX merged commit 7d57b35 into KazariEX:main Aug 27, 2026
1 check passed
@ExEr7um
ExEr7um deleted the fix/no-layout-slots branch September 1, 2026 11:51
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.

2 participants