fix: Propagate public visibility to nested children in registerPublicRoute#608
Merged
Conversation
…Route Fix issue #607 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot started reviewing on behalf of
Alexandre Asselin (alexasselin008)
May 13, 2026 13:50
View session
@squide/core
@squide/env-vars
@squide/fakes
@squide/firefly
@squide/firefly-module-federation
@squide/firefly-rsbuild-configs
@squide/firefly-storybook
@squide/firefly-webpack-configs
@squide/i18next
@squide/launch-darkly
@squide/msw
@squide/react-router
commit: |
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Fixes issue #607 where registerPublicRoute only marked the top-level route as public, causing nested children without an explicit $visibility to default to "protected" and be routed under the wrong outlet.
Changes:
- Added recursive stamping of
$visibility: "public"to nested children when usingregisterPublicRoute, preserving any explicit child$visibility. - Added targeted tests to validate flat, nested, and deeply nested public route registration behavior.
- Added a changeset to publish patch releases for the affected packages.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/react-router/src/ReactRouterRuntime.ts | Recursively applies public visibility to nested children during registerPublicRoute. |
| packages/react-router/tests/ReactRouterRuntime.test.tsx | Adds coverage for registerPublicRoute behavior with nested routes and explicit child visibility. |
| .changeset/cozy-routes-inherit.md | Declares patch releases and documents the fix. |
…dren Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Patrick Lafrance (patricklafrance)
approved these changes
May 13, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix issue #607
registerPublicRouteonly stamped$visibility: "public"on the top-level route. Nested children with no explicit$visibilityfell through to the protected default and ended up under the wrong outlet. A newapplyPublicVisibilityToChildrenhelper now walks the route tree recursively, stamping$visibility: "public"on each descendant while preserving any child that declares its own visibility.Consumer impact
Audited all
registerPublicRoutecall sites across the Workleap org (gh search code 'registerPublicRoute' --owner workleap). No production consumer is behaviorally affected by this change. Every call site falls into one of three categories:childrenpassed — the recursive descent is a no-op. Covers most calls (path: "*",/login,/logout, etc.).children: [PublicRoutes]— thePublicRoutesoutlet placeholder already declares$visibility: "public", so the recursive apply is a no-op. Used bywl-app's shell andwlp-performance-app's shell.sg-protect-web's localregisterPublicRouteshelper (plural) returns aRoute[]consumed byruntime.registerRoute, not the squide API.This fix is therefore a pre-emptive correction for the hypothetical pattern "public route with non-placeholder nested children," which no consumer currently uses.
Audited repos:
wl-app,sg-protect-web,wlp-performance-app,wlp-platform-widgets,wl-agents-code-review-poc.