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
Open
ATLAS-5382: Atlas React UI: Upgrade react-router and react-router-dom from v6 to v7#733Brijesh619 wants to merge 3 commits into
Brijesh619 wants to merge 3 commits into
Conversation
Contributor
Author
Contributor
Author
Contributor
Author
Contributor
Author
Contributor
Author
Contributor
Author
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.







What changes were proposed in this pull request?
This PR resolves ATLAS-5382 by upgrading the
react-routerandreact-router-domdependencies in the Atlas React UI (/dashboard) fromv6to the latestv7.Upgrading to version 7 introduced a known issue with the Jest test environment (
jsdom), which does not natively expose theTextEncoderandTextDecoderglobals 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:
package.json/package-lock.json: Bumpedreact-routerandreact-router-domto^7.18.2.jest.config.js&src/setupTests.polyfills.ts: Created a dedicated pre-test setup file for theTextEncoderandTextDecoderpolyfills (imported from the Node.js nativeutilmodule) and configured it in Jest'ssetupFilesarray. This ensures the polyfills run before test modules are loaded, properly interceptingreact-router-domimports and resolving the crash.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:
npm installandnpm run buildto 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):
npm run testacross the entire/dashboarddirectory.TextEncoderpolyfill runs successfully ahead of component imports, and that all test suites pass, proving identical backwards compatibility with our v6 component usage.Manual UI Verification: