Skip to content

Upgrade react-router from 7.18.0 to 8.0.1 - #522

Merged
cigamit merged 3 commits into
ctrliq:mainfrom
blaipr:feature/react-router-8
Jun 28, 2026
Merged

Upgrade react-router from 7.18.0 to 8.0.1#522
cigamit merged 3 commits into
ctrliq:mainfrom
blaipr:feature/react-router-8

Conversation

@blaipr

@blaipr blaipr commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

SUMMARY

Upgrade react-router from 7.18.0 to 8.0.1 and clean up two migration-era leftovers.

react-router 8 upgrade

  • react-router bumped from 7.18.0 to 8.0.1
  • Jest babel transform: added @babel/plugin-syntax-import-meta and a small import.meta({}) transform — react-router 8 uses import.meta.hot internally, which Jest cannot parse in CJS mode
  • transformIgnorePatterns: consolidated into a single pattern (d3|has-ansi|react-router) so react-router is Babel-transformed during tests

Cleanup: remove routerCompat.js

routerCompat.js was a re-export shim introduced during the v5→v6→v7 migration. All 295 files that imported from it now import directly from 'react-router'. The file is deleted.

Cleanup: remove history devDependency

The history package was used by 191 test files for createMemoryHistory. It is replaced by a Jest moduleNameMapper shim (testUtils/historyShim.js) that delegates to react-router's built-in UNSAFE_createMemoryHistory with v5Compat enabled. Test files continue to import from 'history' unchanged — the mapper redirects to the shim at test time.

Depends on: PR #521 (React 19 upgrade) — react-router 8.0.1 has a hard peer dependency on React 19.2.7+.

ISSUE TYPE

  • New or Enhanced Feature

COMPONENT NAME

  • UI

ASCENDER VERSION

awx: 25.4.1.dev138+g14786f6928.d20260628

ADDITIONAL INFORMATION

Test results: All 552 test suites pass (2911 tests, 0 failures).

This completes the React modernization roadmap critical path:

react-dev-utils was considered for removal but it is deeply wired into the CRA build scripts (webpack config, dev server, build.js, paths.js) — removing it requires rewriting the build toolchain and is deferred to a future PR.

@cigamit cigamit self-assigned this Jun 28, 2026
cigamit
cigamit previously approved these changes Jun 28, 2026
@cigamit cigamit added the Needs triage When a Issue needs to be researched or a PR has an issue that needs fixing before merging label Jun 28, 2026
blaipr added 3 commits June 28, 2026 18:11
- Bump react-router from 7.18.0 to 8.0.1 (requires React 19.2.7+)
- Add import.meta transform to Jest babel config (react-router 8 uses
  import.meta.hot which Jest cannot parse without it)
- Consolidate transformIgnorePatterns into single pattern including
  react-router alongside d3 and has-ansi

All 552 test suites pass (2911 tests).
routerCompat.js was a re-export shim from the v5→v6→v7 migration —
all 295 imports now use react-router directly.

The history package (used by 191 test files for createMemoryHistory)
is replaced by a Jest moduleNameMapper shim that delegates to
react-router's UNSAFE_createMemoryHistory with v5Compat enabled.
No test file changes needed — they still import from 'history' and
the mapper redirects to the shim.
react-router 8 re-exports everything from a single module, so
separate import lines from 'react-router' trigger ESLint's
import-x/no-duplicates rule. Merge them into single imports.

Also fix rtlContexts.js to import createMemoryHistory from the
local historyShim instead of the removed 'history' package.
@blaipr

blaipr commented Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

Rebased to resolve merge conflicts.

@cigamit
cigamit merged commit faffef9 into ctrliq:main Jun 28, 2026
@cigamit cigamit removed the Needs triage When a Issue needs to be researched or a PR has an issue that needs fixing before merging label Jun 28, 2026
sy-base pushed a commit to sy-base/ascender that referenced this pull request Jul 4, 2026
* Upgrade react-router from 7.18.0 to 8.0.1

- Bump react-router from 7.18.0 to 8.0.1 (requires React 19.2.7+)
- Add import.meta transform to Jest babel config (react-router 8 uses
  import.meta.hot which Jest cannot parse without it)
- Consolidate transformIgnorePatterns into single pattern including
  react-router alongside d3 and has-ansi

All 552 test suites pass (2911 tests).

* Remove routerCompat.js indirection and history devDependency

routerCompat.js was a re-export shim from the v5→v6→v7 migration —
all 295 imports now use react-router directly.

The history package (used by 191 test files for createMemoryHistory)
is replaced by a Jest moduleNameMapper shim that delegates to
react-router's UNSAFE_createMemoryHistory with v5Compat enabled.
No test file changes needed — they still import from 'history' and
the mapper redirects to the shim.

* Merge duplicate react-router imports and fix history shim

react-router 8 re-exports everything from a single module, so
separate import lines from 'react-router' trigger ESLint's
import-x/no-duplicates rule. Merge them into single imports.

Also fix rtlContexts.js to import createMemoryHistory from the
local historyShim instead of the removed 'history' package.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants