Upgrade React to v19 and migrate to createRoot API#14
Upgrade React to v19 and migrate to createRoot API#14devin-ai-integration[bot] wants to merge 3 commits into
Conversation
Co-Authored-By: shahmir.masood <shahmir.masood@cognition.ai>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
| "react-icons": "^4.3.1", | ||
| "react": "^19.2.5", | ||
| "react-countdown": "^2.3.6", | ||
| "react-dom": "^19.2.5", |
There was a problem hiding this comment.
🔴 React 19 upgrade breaks CSSTransition: findDOMNode is removed but nodeRef is never passed
The PR upgrades react-dom to v19 where findDOMNode has been removed (verified: typeof ReactDOM.findDOMNode is undefined). However, react-transition-group v4.4.5 calls _reactDom.default.findDOMNode(this) inside CSSTransition whenever the nodeRef prop is not provided. Neither src/components/Modal/Modal.jsx:13 nor src/components/Alert/Alert.jsx:17 pass a nodeRef to CSSTransition, so any transition trigger (opening a modal, showing an alert) will throw a TypeError: _reactDom.default.findDOMNode is not a function at runtime, crashing the app.
Affected CSSTransition usages missing nodeRef
In src/components/Modal/Modal.jsx:13:
<CSSTransition in={isOpen} timeout={300} classNames={'fade'} unmountOnExit>In src/components/Alert/Alert.jsx:17-22:
<CSSTransition in={isVisible} timeout={300} classNames={'fadeIn'} unmountOnExit>Both need a nodeRef prop pointing to a ref attached to their child DOM element.
Prompt for agents
The upgrade to react-dom 19 removes findDOMNode, which react-transition-group v4.4.5 relies on when nodeRef is not provided. Two components need to be updated to pass nodeRef:
1. src/components/Modal/Modal.jsx: Create a ref (e.g. using useRef) and pass it as nodeRef to CSSTransition on line 13. Attach this ref to the outermost child div (the modalContainer div on line 14).
2. src/components/Alert/Alert.jsx: Similarly, create a ref with useRef, pass it as nodeRef to CSSTransition on line 17, and attach it to the child span element on line 23.
Alternatively, consider upgrading to react-transition-group v5 which drops the findDOMNode dependency entirely, though it may require nodeRef to be mandatory.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Good catch — fixed in eca4dca. Added nodeRef to both CSSTransition usages:
Modal.jsx: created anodeRefref and attached it to themodalContainerdivAlert.jsx: created anodeRefref and attached it to thespanchild element
This avoids the findDOMNode call that was removed in React 19.
Co-Authored-By: shahmir.masood <shahmir.masood@cognition.ai>
Co-Authored-By: shahmir.masood <shahmir.masood@cognition.ai>
Summary
Upgrades all React-related packages to their latest versions, migrates from the legacy
ReactDOM.render()API to the newcreateRootAPI, adds working light mode, and changes wrong letter colors to red.Package upgrades:
Code changes:
src/index.js: Migrated fromReactDOM.render()toReactDOM.createRoot().render()src/components/Modal/Modal.jsx: AddednodeReftoCSSTransitionfor React 19 compatibilitysrc/components/Alert/Alert.jsx: AddednodeReftoCSSTransitionfor React 19 compatibilitysrc/App.module.scss: Fixed light mode (body text now uses--color-text-primaryinstead of hardcoded#fff), changed--color-absentto red (#d32f2f)src/App.test.jsx: Fixed pre-existing broken testVerification:
Review & Testing Checklist for Human
Notes
color: #fffmaking text invisible on white background. Fixed to use the theme variable.#405069) to red (#d32f2f).findDOMNoderemoved in React 19 — addednodeReftoCSSTransitionin Modal and Alert.--legacy-peer-deps.Link to Devin session: https://app.devin.ai/sessions/1828fca72be74612be7fc102b5db5095
Requested by: @shahmir-masood
Devin Review