Skip to content

feat(routing)!: upgrade React Router to v8 - #412

Open
IzumiSy wants to merge 5 commits into
mainfrom
chore/react-router-v8-upgrade
Open

feat(routing)!: upgrade React Router to v8#412
IzumiSy wants to merge 5 commits into
mainfrom
chore/react-router-v8-upgrade

Conversation

@IzumiSy

@IzumiSy IzumiSy commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Motivation

AppShell owns the router instance internally and re-exports routing primitives for consumers.
That setup works cleanly as long as the package and the consuming app stay on the same React Router major version, but it can fail at runtime when they drift apart.

This change upgrades AppShell itself to React Router v8, raises the supported React baseline to match React Router's requirements, and updates the docs to reinforce that consumers should import routing primitives from @tailor-platform/app-shell so everything stays on the same router context.

Design Decision

Chosen approach

Keep the upgrade narrow:

  • bump react-router in packages/core
  • raise the workspace and peer React minimums to 19.2.7
  • switch RouterProvider to the DOM-specific import used by React Router v8
  • preserve the existing runtime behavior and public AppShell API shape

Why this upgrade was smooth in AppShell

React Router v8 is a major release, but most of the breaking surface is in baseline/runtime support and in cleanup of compatibility layers that had already been deprecated or gated behind future flags in v7.

AppShell does not rely on most of those areas. Its router usage is mostly limited to stable APIs such as Link, useNavigate, useParams, useSearchParams, useRouteError, and the data-router constructors. Because of that, the AppShell-specific work stayed small: dependency bumps, the RouterProvider import adjustment, and test fixes for v8's ESM-only exports.

Test strategy under ESM-only exports

React Router v8's ESM-only exports made the existing vi.spyOn(react-router, "createMemoryRouter") assertions invalid.

Instead of rewriting the router lifecycle tests completely, this PR adds a tiny local routerFactories indirection so the tests can keep asserting when the router is or is not recreated.

Alternatives considered

A larger rewrite of the routing layer was skipped because the current AppShell usage only needs a dependency/baseline upgrade plus a small import adjustment.

Summary

  • upgrade @tailor-platform/app-shell to React Router v8
  • raise the minimum supported react and react-dom version to 19.2.7
  • update router tests and docs to reflect the single-router-context requirement

@IzumiSy
IzumiSy marked this pull request as ready for review July 31, 2026 03:31
@IzumiSy
IzumiSy requested a review from a team as a code owner July 31, 2026 03:31
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