Repository navigation
ref(plugins): prefer Backstage routing and lazy adapters - #35692
Draft
schultzp2020 wants to merge 12 commits into
Draft
schultzp2020 wants to merge 12 commits into
schultzp2020 wants to merge 12 commits into
Conversation
4 of 5 tasks
schultzp2020
force-pushed
the
feature/33603-scoped-routing-migration
branch
from
September 15, 2026 15:52
12107c9 to
7df9440
Compare
schultzp2020
force-pushed
the
feature/33603-scoped-routing-migration
branch
3 times, most recently
from
September 15, 2026 19:35
a5876ab to
c32e4f2
Compare
Contributor
|
This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution! |
schultzp2020
force-pushed
the
feature/33603-scoped-routing-migration
branch
from
November 9, 2026 21:34
c32e4f2 to
dd01b04
Compare
schultzp2020
force-pushed
the
feature/33603-scoped-routing-base
branch
from
November 9, 2026 21:34
c3f8688 to
d7b3104
Compare
schultzp2020
force-pushed
the
feature/33603-scoped-routing-migration
branch
from
November 9, 2026 21:39
dd01b04 to
2939d70
Compare
Reorganize the existing scoped routing implementation for RFC backstage#33603. Co-authored-by: Cursor <[email protected]> Signed-off-by: Paul Schultz <[email protected]>
Reorganize the existing scoped routing implementation for RFC backstage#33603. Co-authored-by: Cursor <[email protected]> Signed-off-by: Paul Schultz <[email protected]>
Signed-off-by: Paul Schultz <[email protected]>
Signed-off-by: Paul Schultz <[email protected]>
Signed-off-by: Paul Schultz <[email protected]>
Signed-off-by: Paul Schultz <[email protected]>
Signed-off-by: Paul Schultz <[email protected]>
Adapt the plugin migration to the rewritten scoped routing base: - core-components Link binds through the contextual useNavigation hook with an app-history presence check, replacing the removed useAppRouting/useOptionalAppHistory machinery, and keeps the React Router fallback for the old frontend system - useAppHref replaces the removed useHref in EntityRefLink, demo pages, and readouts; RouteLink usages become useRouteRef plus RouterLink; the relative framework link resolves through the nearest navigation provider - app history location reads go through getSnapshot().location (catalog filters, search state, techdocs content data, tests) - Link and demo tests mount adapters through NavigationProvider instead of the removed PageMountProvider, and the TanStack demo readout derives its scoped remainder from the mount base path - shared-component suites keep the base's streamEntities-based EntityListProvider tests and re-add the app-history filter test - chrome components stay on React Router per the base PR's decision (bfecdcc), so ErrorPage, Sidebar, and appRouting conversions are dropped Signed-off-by: Paul Schultz <[email protected]>
The scoped routing PR renamed the adapter packages when it landed: @backstage/plugin-app-react-router-v6/v7 and @backstage/plugin-app-tanstack-router are now @backstage/frontend-adapter-react-router-v6/v7 and @backstage/frontend-adapter-tanstack-router. Update imports, dependencies, and docs accordingly, and regenerate the lockfile. Signed-off-by: Paul Schultz <[email protected]>
schultzp2020
force-pushed
the
feature/33603-scoped-routing-migration
branch
from
November 11, 2026 18:27
2939d70 to
bc8b8d4
Compare
schultzp2020
changed the base branch from
feature/33603-scoped-routing-base
to
master
November 11, 2026 18:27
Contributor
Missing ChangesetsThe following package(s) are changed by this PR but do not have a changeset:
See CONTRIBUTING.md for more information about how to add changesets. Unexpected ChangesetsThe following changeset(s) reference packages that have not been changed in this PR:
Note that only changes that affect the published package require changesets, for example changes to tests and storybook stories do not require changesets. Changed Packages
|
CodeQL flags the parameter segment expression in compilePath as a potential polynomial-time regular expression on inputs like long runs of dashes. Replace it with a linear scan: the name is the longest run of word characters after the colon, an optional question mark follows, and the remainder is a literal suffix. Segment semantics are unchanged, covered by a no-backtracking regression test on adversarial input. Signed-off-by: Paul Schultz <[email protected]>
schultzp2020
force-pushed
the
feature/33603-scoped-routing-migration
branch
from
November 11, 2026 18:53
bc8b8d4 to
ee9cf5a
Compare
The featured-templates home widget renders on the home page grid, outside any page adapter, so React Router's useNavigate only worked through implicit compatibility and warned in development. Use useAppNavigate, which prefers the app history and falls back to React Router in the old frontend system. Signed-off-by: Paul Schultz <[email protected]>
React 18 is required, so useSyncExternalStore comes from React itself. Import the native hook in the app history location and router, route ref resolution, and the UI breakpoint hook, and remove the now-unused use-sync-external-store and @types/use-sync-external- store dependencies, including the re-declarations the inline-package rule required. Drop the React 17 fallback mock from the app history location test; it exercises the native hook like every other suite. Signed-off-by: Paul Schultz <[email protected]>
Contributor
This branch has not been deployed
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.
Hey, I just made a Pull Request!
Adopts the scoped routing introduced in #34830, following RFC #33603. Rebased onto the current head of the routing PR, so the API surface is the rewritten one:
useAppHref,RouterLink, contextualuseNavigation, andgetSnapshot()-based app history reads.This diagram shows how framework navigation and the remaining local routers share one history.
What changed
api-docs,catalog-graph,catalog-import,catalog-unprocessed-entities,home,notifications,search, anduser-settings. Catalog and TechDocs index pages, plus scaffolder actions and templating-extension pages, also render without adapters.Linkbinds through contextualuseNavigationwhen app history is registered and falls back to React Router otherwise;EntityRefLinkresolves throughuseAppHref. Link targets retain deployment basenames, native modified clicks, downloads, navigation state, and replacement behavior.ErrorPage,Sidebar) intentionally stay on React Router for now, following the routing PR's own decision; routerless chrome is a later step on top of both PRs.getSnapshot(). Search Back/Forward restores cleared parameters as well as populated ones.catalog/exampleresolve from the app root; search modal submissions encode terms containing URLs.react-router-dompeers, and the v6 adapter's redundantreact-routerpeer. Comments, tests, examples, and changesets reflect the current routing behavior.Compatibility and migration
This migration can land separately from the feature. #34830 retains implicit v6 compatibility for existing new frontend pages and warns in development when an extension consumes it. Plugins need no immediate migration. Pages using only Backstage routing, or no routing at all, need no adapter declaration and receive no migration warning.
Legacy frontend exports and their outlet customization remain supported. The shared helpers use React Router fallback when app history is absent. Converted legacy routes keep their compatibility adapters.
This PR targets
feature/33603-scoped-routing-baseso the diff contains only migration and example-app changes. Rebase and retarget it tomasterafter #34830 merges.Demo and remaining limits
The example app exercises mixed-adapter tabs and nested routes at
/nfs-routing-demo,/nfs-routing-demo-v7, and/nfs-routing-demo-tanstack. Adapters load with their React components. One tab deliberately uses implicit compatibility; other pages demonstrate framework routing without adapters. Panels show resolved URLs and link destinations, with route-ref links built fromuseRouteRefplusRouterLink.Regression coverage includes migrated plugin navigation, routerless links, legacy tabs, query edits and history traversal, action fragments, and the mixed-router demos. On the rebased head: 914 suites / 7448 tests pass across all touched workspaces, with repo-wide type checking and API report generation clean. Backend database suites that require a container runtime are excluded locally.
React Router remains required for supported legacy routing and the local route trees listed above. Navigation blockers and custom-history restoration retain the limits described in #34830.
✔️ Checklist
Signed-off-byline in the message. (more info)