[AppConfig]: upgrade react router v7#1001
Open
carcruz wants to merge 14 commits into
Open
Conversation
Migrates from react-router-dom v6.30.4 to the unified react-router package (v7.18.1) across apps/platform, apps/docs, packages/ui, and packages/sections. react-router-dom was retired in favor of the unified package; v8 was skipped since it requires React 19, which would force an unrelated major upgrade. Usage is purely declarative (BrowserRouter/Routes/Route/hooks), so this is a straightforward import-path migration with no behavioral changes. Also fixes tech debt surfaced while verifying this change (confirmed unrelated to react-router, predating this branch): adds the repo-wide-missing @types/lodash package, declares 3dmol and lodash as explicit dependencies where they were used but undeclared (relying on accidental hoisting), and restores skipLibCheck to true to stop type-checking third-party packages' broken .d.ts files.
It's Yarn Berry's internal resolution cache, regenerated on every install, and not needed since this repo doesn't use Zero-Installs (nodeLinker: node-modules, no committed .yarn/cache).
Applies the existing lazy-wrapper pattern (already used by Downloads/API/Projects pages) to the 8 remaining eager pages: Disease, Drug, Target, Evidence, Variant, Study, CredibleSet, and Analysis. Each gets a thin Wrapper that lazy-imports the real page behind a Suspense boundary; App.tsx itself is unchanged since it already imports pages through their directory index. HomePage and NotFoundPage stay eager intentionally: HomePage is the default landing route (lazy-loading it would add a loading flash for the most common entry point), and NotFoundPage is rendered inline without a Suspense boundary in a couple of data pages. Cuts the main platform bundle from ~9MB (2.66MB gzip) to ~2.6MB (767KB gzip); heavy dependencies like cytoscape (5.2MB) and the associations network view now load on demand instead of upfront.
CI run for this PR showed the disease page header test consistently timing out at the default 5000ms expect() timeout - Playwright's own page snapshot at failure time showed the page still on its loading spinner, not a broken page (other tests confirm the same page renders correctly with more time). Root cause: page components are now code-split (previous commit), so the first navigation to any of the 8 newly-lazy pages needs to fetch an extra JS chunk before rendering, on top of normal query latency. That's normally trivial (~5-12KB gzipped) but a cold Netlify PR preview plus CI runner contention pushed it past 5s here. The same profile-page-header-text assertion pattern is used across multiple page specs (disease, target, drug, etc.), so this is scoped as a global default rather than a single-test patch.
…outer-v7 # Conflicts: # apps/docs/package.json # apps/platform/package.json # packages/sections/package.json # packages/ui/package.json # yarn.lock
… chore/upgrade-react-router-v7
… analysis, and implement lazy loading for Viewer component
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.
[AppConfig]: upgrade react router v7
Type of change
Checklist: