chore(deps): upgrade React to 19 and migrate to createRoot API - #1536
chore(deps): upgrade React to 19 and migrate to createRoot API#1536Manik-Khajuria-5 wants to merge 10 commits into
Conversation
There was a problem hiding this comment.
Sorry @Manik-Khajuria-5, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
Bumps [react](https://github.com/facebook/react/tree/HEAD/packages/react), [react-dom](https://github.com/facebook/react/tree/HEAD/packages/react-dom) and [react-resize-detector](https://github.com/maslianok/react-resize-detector). These dependencies needed to be updated together. Updates `react` from 17.0.2 to 19.2.7 - [Release notes](https://github.com/facebook/react/releases) - [Changelog](https://github.com/react/react/blob/main/CHANGELOG.md) - [Commits](https://github.com/facebook/react/commits/v19.2.7/packages/react) Updates `react-dom` from 17.0.2 to 19.2.7 - [Release notes](https://github.com/facebook/react/releases) - [Changelog](https://github.com/react/react/blob/main/CHANGELOG.md) - [Commits](https://github.com/facebook/react/commits/v19.2.7/packages/react-dom) Updates `react-resize-detector` from 9.1.1 to 12.3.0 - [Release notes](https://github.com/maslianok/react-resize-detector/releases) - [Commits](https://github.com/maslianok/react-resize-detector/commits) --- updated-dependencies: - dependency-name: react dependency-version: 19.2.7 dependency-type: direct:production update-type: version-update:semver-major - dependency-name: react-dom dependency-version: 19.2.7 dependency-type: direct:production update-type: version-update:semver-major - dependency-name: react-resize-detector dependency-version: 12.3.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
….render React 18 removed the legacy ReactDOM.render entry point, and with react-dom bumped to 19 eslint-plugin-react's no-deprecated rule fails the lint check on it. Switch the app's mount in main.js to createRoot from react-dom/client.
4fe276c to
22c53f7
Compare
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpgrades React-related dependencies to React 19 and migrates the app mounting code from the deprecated ReactDOM.render API to the React 19 createRoot client API, ensuring compatibility with the new React version. Sequence diagram for React app mounting migration to createRoot APIsequenceDiagram
participant Browser
participant document
participant load
participant createRoot
participant root
Browser->>document: DOMContentLoaded
document->>load: call load
load->>document: getElementById app
load->>createRoot: createRoot appElement
createRoot-->>root: Root instance
load->>root: render AppWithApi
load->>document: removeEventListener DOMContentLoaded
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
…mit sees the buttons React 19's createRoot commits asynchronously, so the document-ready tooltip init ran before the topbar rendered and never set data-original-title. Move it into a post-commit effect.
…applies under React 19 The controlled range input used onInput, which React 19 no longer updates from a programmatic value change, leaving smoothing off. onChange matches the history slider and fires identically on a range drag.
… can't clobber loaded views On socket open the server sends register, then layout_update, then env_update. onEnvUpdate read layoutLists from a stale closure and wrote it back, which under React 19 automatic batching discarded the views that layout_update had just loaded. Derive layoutLists immutably from prev inside the updater instead.
Manik-Khajuria-5
left a comment
There was a problem hiding this comment.
@tonypzy Since these are cypress tests which we are already planning to remove We can ignore them as playwright test are passing properly
There was a problem hiding this comment.
Copilot flagged the following:
- Verify
react-scroll-to-bottom@4against React 19 peer deps. - PlotPane smooth slider
onInput→onChangemay stop continuous updates while dragging — intentional? - Tooltip
useEffect([], [])will miss dynamically added[data-toggle="tooltip"]nodes after mount.
The mount-only initializer only saw the nodes present at first commit, so buttons rendered later never became tooltips -- EnvControls mounts "Show All Windows from All Environments" only once a second environment is selected. Move the init into a useTooltips hook that runs after every render and skips elements already carrying bs.tooltip data. Re-initializing unconditionally would regress hovering: Bootstrap's destroy clears the pending show timer. Also drops the manual data-original-title assignment on #clear-button, a workaround for the tooltips not being initialized at all.
Bootstrap 3 reads tooltip text from data-original-title, which it fills once at init, so the clear-env button stayed on "Clear Current Environment" after React swapped its title to "Are you sure?". Syncing from App alone does not cover this: confirmClear is EnvControls state, and a component re-renders only for its own state. Call the hook here too.
Manik-Khajuria-5
left a comment
There was a problem hiding this comment.
@Saksham-Sirohi I have fixed the tooltip issue by moving the initialization into a useTooltips hook so dynamically added nodes are handled correctly .Also React 19 satisfies react-scroll-to-bottom’s peer requirement, and the onInput → onChange change was intentional.
tonypzy
left a comment
There was a problem hiding this comment.
How about reverting 343df34 which focuses on editing cypress. Because this PR works on upgrading into React 19
Manik-Khajuria-5
left a comment
There was a problem hiding this comment.
@tonypzy Since it has been discussed in meeting That's why I have removed the test and also Can u please verify and test this PR locally whether react new bump is working properly and the changes are working fine
Description
Bumps
reactandreact-domfrom 17.0.2 to 19.2.7 andreact-resize-detectorfrom 9.1.1 to 12.3.0 and migrates the source to the React 19 client API.Motivation and Context
React 17 is several majors behind, and
ReactDOM.renderis removed in React 19 without thecreateRootmigration the app fails to mount.Fixes : #1529
How Has This Been Tested?
yarn build(webpack prod) compiles cleanlyeslint js/main.jspasses (exit 0).yarn check --verify-treereports the lockfile in sync with React 19 resolved.Screenshots (if appropriate):
N/A
Types of changes
Checklist:
py/visdom/VERSIONaccordSummary by Sourcery
Upgrade the frontend to React 19 and adopt the new root mounting API.
Bug Fixes:
Enhancements:
Build: