Skip to content

fix(navigation): preserve redirecting pages and descendants - #660

Draft
IzumiSy wants to merge 1 commit into
mainfrom
fix/redirect-guard-navigation
Draft

IzumiSy wants to merge 1 commit into
mainfrom
fix/redirect-guard-navigation

Conversation

@IzumiSy

@IzumiSy IzumiSy commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Motivation

A parent page that returns redirectTo() currently removes its entire subtree from Command Palette entries and automatic sidebar navigation. This makes reachable child pages disappear even though page guards apply only to their own index routes, not to descendants.

Redirect-only pages without a component are also valid navigation entry points, but were treated as non-navigable namespaces. Redirecting to a default child should not require a placeholder component or hide the parent link.

Design Decision

Keep redirect behavior separate from visibility

Only hidden() prunes a navigation subtree. A redirect result makes the page navigable even without a component, while componentless pages returning pass() remain non-clickable. Links retain their original paths so the route guard runs on navigation rather than baking its redirect destination into the menu.

This applies to both shared static navigation and current-path-aware dynamic Palette entries. AutoSidebar's display depth and page-guard inheritance remain unchanged.

Summary

  • Preserve redirecting parents and visible descendants in AutoSidebar and Command Palette entries, including redirect-only root pages, modules, and resources.
  • Add regression coverage for componentful/componentless parents, redirect-only leaves, dynamic routes, pass()/hidden() behavior, and AutoSidebar/Palette integration.
  • Include a patch changeset.
  • Type checking, lint, the full test suite (2,675 core tests), formatting, and the pre-commit documentation check passed. Published-declaration validation timed out during fixture installation. Browser style tests passed (382 tests) before the redirect-only follow-up and were not rerun afterward.

@github-actions

Copy link
Copy Markdown
Contributor

Code Metrics Report

main (b8ead52) #660 (d405593) +/-
Coverage 89.5% 89.5% +0.0%
Test Execution Time 3m20s 3m10s -10s
Details
  |                     | main (b8ead52) | #660 (d405593) |  +/-  |
  |---------------------|----------------|----------------|-------|
+ | Coverage            |          89.5% |          89.5% | +0.0% |
  |   Files             |            236 |            236 |     0 |
  |   Lines             |           7517 |           7518 |    +1 |
+ |   Covered           |           6732 |           6734 |    +2 |
+ | Test Execution Time |          3m20s |          3m10s |  -10s |

Code coverage of files in pull request scope (94.4% → 94.7%, patch 100.0%)

Files Coverage +/- Patch Coverage Status
packages/core/src/components/command-palette/command-palette.tsx 92.8% 0.0% - modified
packages/core/src/components/internals/breadcrumb/breadcrumb.tsx 87.5% +12.5% - affected
packages/core/src/routing/navigation.tsx 100.0% 0.0% 100.0% modified

Reported by octocov

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.

1 participant