๐ŸŒ AIๆœ็ดข & ไปฃ็† ไธป้กต
Skip to content

Conversation

@Flo0806
Copy link
Member

@Flo0806 Flo0806 commented Nov 27, 2025

๐Ÿ”— Linked issue

Resolves: #33766

๐Ÿ“š Description

Fixes a visual flash when navigating between nested routes with different depths (e.g., 3 levels โ†’ 2 levels).

The condition at line 133 only checked hasSameChildren (same route depth) before returning the existing vnode. When navigating from a deeper to a shallower route, it would return null even though a valid vnode existed - causing a brief flash.

Fix: if (hasSameChildren) โ†’ if (hasSameChildren || vnode)

Now null is only returned when there was no previous content (as the comment always intended).

@Flo0806 Flo0806 requested a review from danielroe as a code owner November 27, 2025 22:17
@bolt-new-by-stackblitz
Copy link

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

@coderabbitai
Copy link

coderabbitai bot commented Nov 27, 2025

Walkthrough

The vnode-rendering condition in the page runtime was changed: during route transitions the code now returns the previous vnode when either the number of children is the same or an existing vnode is present (hasSameChildren || vnode). If that condition is not met, the existing fallback that returns a null vnode when leaving a route with a null child remains unchanged.

Possibly related PRs

Pre-merge checks and finishing touches

โœ… Passed checks (5 passed)
Check name Status Explanation
Title check โœ… Passed The title accurately and concisely describes the main change: fixing vnodes when leaving deeper nested routes, matching the core fix in the changeset.
Description check โœ… Passed The description clearly explains the problem, root cause, and solution, directly relating to the code change and linked issue.
Linked Issues check โœ… Passed The code change directly addresses issue #33766 by implementing the exact fix needed to prevent page flashes when navigating between nested routes of different depths.
Out of Scope Changes check โœ… Passed The change is narrowly scoped to the specific condition in page.ts that caused the bug; no extraneous modifications are present.
Docstring Coverage โœ… Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
โœจ Finishing touches
  • ๐Ÿ“ Generate docstrings
๐Ÿงช Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

๐Ÿ“ Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests โ€” including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. ๐Ÿ“ Description โ€” Summarize the main change in 50โ€“60 words, explaining what was done.
  2. ๐Ÿ““ References โ€” List relevant issues, discussions, documentation, or related PRs.
  3. ๐Ÿ“ฆ Dependencies & Requirements โ€” Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. ๐Ÿ“Š Contributor Summary โ€” Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. โœ”๏ธ Additional Notes โ€” Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Tip

โœจ Issue Enrichment is now available for GitHub issues!

CodeRabbit can now help you manage issues more effectively:

  • Duplicate Detection โ€” Identify similar or duplicate issues
  • Related Issues & PRs โ€” Find relevant issues and PR's from your repository
  • Suggested Assignees โ€” Find the best person to work on the issue
  • Implementation Planning โ€” Generate detailed coding plans for engineers and agents
Disable automatic issue enrichment

To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

issue_enrichment:
  auto_enrich:
    enabled: false

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.

@Flo0806 Flo0806 force-pushed the fix/page-flash-nested-routes branch from 643a47e to ac62ad4 Compare November 27, 2025 22:20
@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 27, 2025

Open in StackBlitz

@nuxt/kit

npm i https://pkg.pr.new/@nuxt/kit@33778

@nuxt/nitro-server

npm i https://pkg.pr.new/@nuxt/nitro-server@33778

nuxt

npm i https://pkg.pr.new/nuxt@33778

@nuxt/rspack-builder

npm i https://pkg.pr.new/@nuxt/rspack-builder@33778

@nuxt/schema

npm i https://pkg.pr.new/@nuxt/schema@33778

@nuxt/vite-builder

npm i https://pkg.pr.new/@nuxt/vite-builder@33778

@nuxt/webpack-builder

npm i https://pkg.pr.new/@nuxt/webpack-builder@33778

commit: ac62ad4

Copy link

@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: 0

๐Ÿงน Nitpick comments (1)
packages/nuxt/src/pages/runtime/page.ts (1)

132-135: Consider updating the comment for precision.

The comment states "if leaving a route with an existing child route", but the condition now also returns the old vnode when any previous vnode exists, regardless of whether child routes match. Consider updating to reflect both conditions:

-              // if leaving a route with an existing child route, render the old vnode
+              // if leaving a route with same number of children or any existing vnode, render the old vnode
               if (hasSameChildren || vnode) {
                 return vnode
               }
๐Ÿ“œ Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 643a47e and ac62ad4.

๐Ÿ“’ Files selected for processing (1)
  • packages/nuxt/src/pages/runtime/page.ts (1 hunks)
๐Ÿงฐ Additional context used
๐Ÿ““ Path-based instructions (2)
**/*.{ts,tsx,vue}

๐Ÿ“„ CodeRabbit inference engine (.github/copilot-instructions.md)

Follow standard TypeScript conventions and best practices

Files:

  • packages/nuxt/src/pages/runtime/page.ts
**/*.{ts,tsx,js,jsx,vue}

๐Ÿ“„ CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx,js,jsx,vue}: Use clear, descriptive variable and function names
Add comments only to explain complex logic or non-obvious implementations
Keep functions focused and manageable (generally under 50 lines), and extract complex logic into separate domain-specific files
Remove code that is not used or needed
Use error handling patterns consistently

Files:

  • packages/nuxt/src/pages/runtime/page.ts
๐Ÿง  Learnings (1)
๐Ÿ“š Learning: 2024-12-12T12:36:34.871Z
Learnt from: huang-julien
Repo: nuxt/nuxt PR: 29366
File: packages/nuxt/src/app/components/nuxt-root.vue:16-19
Timestamp: 2024-12-12T12:36:34.871Z
Learning: In `packages/nuxt/src/app/components/nuxt-root.vue`, when optimizing bundle size by conditionally importing components based on route metadata, prefer using inline conditional imports like:

```js
const IsolatedPage = route?.meta?.isolate ? defineAsyncComponent(() => import('#build/isolated-page.mjs')) : null
```

instead of wrapping the import in a computed property or importing the component unconditionally.

Applied to files:

  • packages/nuxt/src/pages/runtime/page.ts
๐Ÿ”‡ Additional comments (1)
packages/nuxt/src/pages/runtime/page.ts (1)

133-133: I apologize for the technical difficulty. The repository clone has failed, which prevents me from directly examining the codebase to verify the review comment.

Let me assess the review comment based on the information provided:

The review comment contains a well-structured analysis with:

  • Detailed scratchpad tracking of the fix logic
  • Clear explanation of how the change (|| vnode) prevents visual flash
  • Identification of guards and fallback behavior
  • A specific verification request for nested route navigation test coverage

However, I cannot complete the verification because:

  1. Cannot access the actual file to confirm line numbers, context, and code structure
  2. Cannot search for or verify the existence of nested route navigation tests
  3. Cannot independently validate the claims about vnode initialization and guard conditions

Given this limitation, the review comment cannot be definitively verified or rewritten with confidence. The comment appears technically sound based on the logic described, but without access to the codebase, I cannot confirm:

  • Whether the analysis of line 133's context is accurate
  • Whether the guards at lines 113 and 131 function as described
  • Whether test coverage for nested routes actually exists or is needed

Would you be able to:

  1. Provide direct access to view the file content, or
  2. Confirm whether you'd like me to proceed with the review comment as-is given the verification constraints?

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 27, 2025

CodSpeed Performance Report

Merging #33778 will not alter performance

Comparing Flo0806:fix/page-flash-nested-routes (ac62ad4) with main (81356f8)

Summary

โœ… 10 untouched

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Page Briefly Disappears When Navigating Between Two Different Deeply Nested Routes

1 participant