Skip to content

Document layout composition pitfalls#246

Open
bcomnes wants to merge 4 commits intomasterfrom
docs/layout-composition-pitfalls
Open

Document layout composition pitfalls#246
bcomnes wants to merge 4 commits intomasterfrom
docs/layout-composition-pitfalls

Conversation

@bcomnes
Copy link
Copy Markdown
Owner

@bcomnes bcomnes commented Apr 18, 2026

Closes #232

The nested layouts section shows the correct pattern but does not warn about the ways it can silently go wrong. Three pitfalls trip up most users composing layouts for the first time:

  1. Forgetting to forward scripts and styles to the base layout drops all CSS and JS bundles from the page with no error message.
  2. Vars can be modified or extended before forwarding, which is useful for setting layout-specific flags that the root layout reads.
  3. When the base layout uses page, pages, or workers, those params must also be forwarded explicitly.

This adds a "Layout composition pitfalls" subsection with concrete right/wrong examples for each case.

@coveralls
Copy link
Copy Markdown

coveralls commented Apr 18, 2026

Coverage Report for CI Build 24619423454

Coverage remained the same at 91.469%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 4070
Covered Lines: 3804
Line Coverage: 93.46%
Relevant Branches: 642
Covered Branches: 506
Branch Coverage: 78.82%
Branches in Coverage %: Yes
Coverage Strength: 73.64 hits per line

💛 - Coveralls

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new “Layout composition pitfalls” subsection to the README to warn about common silent failure modes when composing nested layouts.

Changes:

  • Documented the need to explicitly forward scripts and styles to avoid silently dropping CSS/JS bundles.
  • Added an example showing how to extend/modify vars before forwarding to a base layout.
  • Added a checklist-style example calling out forwarding page, pages, and workers when the base layout relies on them.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
Comment thread README.md
Comment thread README.md Outdated
Replace rootLayout/wrappedContent/wrapContent with identifiers that are
actually defined in the surrounding context (defaultRootLayout and children),
making the snippets copy-pasteable and consistent with the nested layout
example above.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md Outdated
… name collision

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

Strengthen layout composition documentation with pitfall warnings

3 participants