Skip to content

docs: add v4.4 badge for layout props#34528

Merged
danielroe merged 1 commit into
nuxt:mainfrom
onmax:docs/layout-props-v4-4-badge
Mar 12, 2026
Merged

docs: add v4.4 badge for layout props#34528
danielroe merged 1 commit into
nuxt:mainfrom
onmax:docs/layout-props-v4-4-badge

Conversation

@onmax
Copy link
Copy Markdown
Contributor

@onmax onmax commented Mar 12, 2026

closes #34527

image

@onmax onmax requested a review from danielroe as a code owner March 12, 2026 11:37
@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions github-actions Bot added 5.x 📚 documentation Documentation improvements or additions labels Mar 12, 2026
@onmax onmax force-pushed the docs/layout-props-v4-4-badge branch from 587f50a to 9fdefc9 Compare March 12, 2026 11:42
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 12, 2026

Walkthrough

A documentation change was made to the Nuxt directory-structure layouts page: the "Passing Props to Layouts" section heading was updated to include a version badge for 4.4. No other content, functional code, or exported/public declarations were modified; the change is a single-line edit to the documentation file that adds version context to the heading.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check ❓ Inconclusive The PR addresses issue #34527 by adding documentation clarity via a v4.4 badge, though the core bug (object syntax not working) lacks explicit code implementation. Clarify whether this documentation change alone resolves the issue or if code changes are also required to fix the object syntax functionality in Nuxt.
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description is related to the changeset, referencing the closed issue and including a screenshot showing the documentation page with the added badge.
Out of Scope Changes check ✅ Passed The changes are narrowly scoped to documentation only, adding a version badge to a single heading without introducing unrelated modifications.
Title check ✅ Passed The pull request title 'docs: add v4.4 badge for layout props' directly and clearly summarizes the main change, which is adding a v4.4 badge to the 'Passing Props to Layouts' documentation section.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
docs/2.directory-structure/1.app/1.layouts.md (1)

173-219: Mention that layoutProps values must be serialisable.

This section currently reads as if any prop object will work, but the runtime stores layoutProps on route meta / payload state. A short note here would help users avoid passing refs, functions, or class instances that will not survive SSR/hydration cleanly.

✏️ Suggested wording
 You can pass props to a layout by providing a `layoutProps` object in [`definePageMeta`](/docs/4.x/api/utils/define-page-meta):
+
+`layoutProps` should only contain serialisable values.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/2.directory-structure/1.app/1.layouts.md` around lines 173 - 219, Add a
short note explaining that layoutProps (as used with definePageMeta and when
passing props via setPageLayout) must be serialisable because they are stored on
the route meta/payload and survive SSR/hydration; explicitly warn authors not to
pass refs, functions, or class instances (use plain JSON-serialisable values)
and insert this sentence near the examples that demonstrate layoutProps and the
admin NuxtLayouts declaration so users see the restriction before the admin.vue
layout example.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/nuxt/src/app/composables/asyncData.ts`:
- Around line 843-859: On the branch where purgeCachedData &&
!hasCustomGetCachedData is true, eagerly clear nuxtApp.payload.data[key] and
nuxtApp.payload._errors?.[key] before deferring the silent dispose to nextTick
to avoid a same-flush recreation reusing stale payload or error; keep the
deferred call to nextTick(() => { if (!nuxtApp._asyncData[key]?._init)
clearNuxtDataByKey(nuxtApp, key, { silent: true }) }) and the existing
_preserveOnInit logic, but move the payload and _errors deletion to run
immediately when deciding not to preserve (i.e., in the else branch before
nextTick) so new createAsyncData/useNuxtData instances cannot inherit old data
or errors.

---

Nitpick comments:
In `@docs/2.directory-structure/1.app/1.layouts.md`:
- Around line 173-219: Add a short note explaining that layoutProps (as used
with definePageMeta and when passing props via setPageLayout) must be
serialisable because they are stored on the route meta/payload and survive
SSR/hydration; explicitly warn authors not to pass refs, functions, or class
instances (use plain JSON-serialisable values) and insert this sentence near the
examples that demonstrate layoutProps and the admin NuxtLayouts declaration so
users see the restriction before the admin.vue layout example.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 53a0a369-1205-4fcc-8e66-4eed9352bd1d

📥 Commits

Reviewing files that changed from the base of the PR and between 0e395ba and 587f50a.

📒 Files selected for processing (5)
  • docs/2.directory-structure/1.app/1.layouts.md
  • docs/4.api/3.utils/set-page-layout.md
  • packages/nuxt/src/app/composables/asyncData.ts
  • packages/nuxt/src/app/nuxt.ts
  • test/nuxt/use-async-data.test.ts

Comment thread packages/nuxt/src/app/composables/asyncData.ts Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
docs/2.directory-structure/1.app/1.layouts.md (1)

177-228: Consider documenting the layoutProps field for pre-4.4 compatibility.

According to issue #34527, whilst the object syntax (layout: { name, props }) requires v4.4, the layoutProps field works in earlier versions:

definePageMeta({
  layout: 'panel',
  layoutProps: {
    sidebar: true,
    title: 'Dashboard'
  }
})

Users on versions before 4.4 would benefit from having this alternative documented, perhaps in a note or a separate subsection. Additionally, verify whether setPageLayout with props (line 227) also requires v4.4, and if so, add a corresponding version indicator.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/2.directory-structure/1.app/1.layouts.md` around lines 177 - 228, Add
documentation for the pre-4.4 compatibility field by describing the layoutProps
alternative and showing its usage (e.g., in definePageMeta use layout: 'panel'
plus layoutProps: { sidebar: true, title: 'Dashboard' }); include a short note
or subsection explaining that the object syntax layout: { name, props } requires
v4.4 while layoutProps works in earlier versions, and update the setPageLayout
mention to indicate whether passing props via setPageLayout(...) requires v4.4
(verify implementation of setPageLayout and add a version indicator next to its
example if it does).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/2.directory-structure/1.app/1.layouts.md`:
- Line 171: The version badge on the "Passing Props to Layouts" heading is
incorrect—change the badge token :badge[+4.4]{color="info" class="align-middle"}
to :badge[+4.3]{color="info" class="align-middle"} (or :badge[+4.3.0]{...}) so
the header "## Passing Props to Layouts :badge[+4.4]{...}" correctly reflects
the feature shipping in Nuxt v4.3.0.

---

Nitpick comments:
In `@docs/2.directory-structure/1.app/1.layouts.md`:
- Around line 177-228: Add documentation for the pre-4.4 compatibility field by
describing the layoutProps alternative and showing its usage (e.g., in
definePageMeta use layout: 'panel' plus layoutProps: { sidebar: true, title:
'Dashboard' }); include a short note or subsection explaining that the object
syntax layout: { name, props } requires v4.4 while layoutProps works in earlier
versions, and update the setPageLayout mention to indicate whether passing props
via setPageLayout(...) requires v4.4 (verify implementation of setPageLayout and
add a version indicator next to its example if it does).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: fed4476f-d152-4f23-905f-da9ca308eaa6

📥 Commits

Reviewing files that changed from the base of the PR and between 587f50a and 9fdefc9.

📒 Files selected for processing (1)
  • docs/2.directory-structure/1.app/1.layouts.md

Comment thread docs/2.directory-structure/1.app/1.layouts.md Outdated
Copy link
Copy Markdown
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

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

❤️

@onmax onmax force-pushed the docs/layout-props-v4-4-badge branch from 9fdefc9 to 4b88652 Compare March 12, 2026 12:02
@onmax onmax changed the title docs(layouts): add v4.4 badge for layout props docs: add v4.4 badge for layout props Mar 12, 2026
@danielroe danielroe added this pull request to the merge queue Mar 12, 2026
Merged via the queue into nuxt:main with commit c532665 Mar 12, 2026
19 of 22 checks passed
@github-actions github-actions Bot mentioned this pull request Mar 12, 2026
4 tasks
@github-actions github-actions Bot mentioned this pull request Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5.x 📚 documentation Documentation improvements or additions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

definePageMeta layout object syntax does not work as documented

2 participants