Skip to content

ATLAS-5382: Atlas React UI: Upgrade react-router and react-router-dom from v6 to v7 - #733

Open
Brijesh619 wants to merge 3 commits into
apache:masterfrom
Brijesh619:ATLAS-5382
Open

ATLAS-5382: Atlas React UI: Upgrade react-router and react-router-dom from v6 to v7#733
Brijesh619 wants to merge 3 commits into
apache:masterfrom
Brijesh619:ATLAS-5382

Conversation

@Brijesh619

@Brijesh619 Brijesh619 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This PR resolves ATLAS-5382 by upgrading the react-router and react-router-dom dependencies in the Atlas React UI (/dashboard) from v6 to the latest v7.

Upgrading to version 7 introduced a known issue with the Jest test environment (jsdom), which does not natively expose the TextEncoder and TextDecoder globals that the modern router relies on, causing the test suite to crash immediately upon importing routing components.

To safely migrate to v7 while keeping the test suite green, this PR includes the following changes:

  1. package.json / package-lock.json: Bumped react-router and react-router-dom to ^7.18.2.
  2. jest.config.js & src/setupTests.polyfills.ts: Created a dedicated pre-test setup file for the TextEncoder and TextDecoder polyfills (imported from the Node.js native util module) and configured it in Jest's setupFiles array. This ensures the polyfills run before test modules are loaded, properly intercepting react-router-dom imports and resolving the crash.
  3. src/setupTests.simple.ts: Kept clean and solely dedicated to post-environment setup (setupFilesAfterEnv).

(Note: There were no code-level deprecations or breaking API changes that affected our React components. All useNavigate, useLocation, <Routes>, and <Route> implementations remain fully compatible with v7).

How was this patch tested?

Build & Type Tests:

  • Ran npm install and npm run build to ensure the TypeScript compiler successfully builds the app without any type errors or API deprecation warnings from the new router version.

Unit Tests (Resolving the Jest crash):

  • Ran npm run test across the entire /dashboard directory.
  • Verified that the dedicated TextEncoder polyfill runs successfully ahead of component imports, and that all test suites pass, proving identical backwards compatibility with our v6 component usage.

Manual UI Verification:

  • Started the local Vite dev server and verified that the client-side router functions correctly in the browser. Navigated between main tabs (Administrator, Search, Entities, Lineage) to ensure the URL updates and views render as expected.

@Brijesh619

Copy link
Copy Markdown
Contributor Author
Screenshot from 2026-08-19 12-02-04

@Brijesh619

Copy link
Copy Markdown
Contributor Author
Screenshot from 2026-08-19 12-04-04

Comment thread dashboard/src/setupTests.simple.ts Outdated
Comment thread dashboard/src/setupTests.simple.ts Outdated
@Brijesh619

Copy link
Copy Markdown
Contributor Author
Screenshot from 2026-08-21 16-11-07 Screenshot from 2026-08-21 16-01-51

@Brijesh619

Copy link
Copy Markdown
Contributor Author
Screenshot from 2026-08-21 16-39-27

Comment thread dashboard/package.json Outdated
@Brijesh619

Copy link
Copy Markdown
Contributor Author
Screenshot from 2026-08-24 16-31-05

@Brijesh619

Copy link
Copy Markdown
Contributor Author
Screenshot from 2026-08-24 16-35-59

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.

2 participants