Skip to content

chore: Upgrade React 15 to React 18#173

Merged
andykog merged 10 commits into
masterfrom
chore/upgrade-react-18
Jun 17, 2026
Merged

chore: Upgrade React 15 to React 18#173
andykog merged 10 commits into
masterfrom
chore/upgrade-react-18

Conversation

@andykog

@andykog andykog commented Jun 16, 2026

Copy link
Copy Markdown
Member

Summary

Upgrades the React dependency from v15 to v18 across the entire devtools frontend and playground apps.

Changes

Package versions

  • Upgraded react and react-dom from ^15.7.0 to ^18.2.0 in root package.json
  • Upgraded react-test-renderer from ^15.7.0 to ^18.2.0
  • Removed react-addons-test-utils (React 15 only, not compatible with React 18)
  • Upgraded react and react-dom from ^16.13.1 to ^18.2.0 in packages/playground/package.json

ReactDOM.render to createRoot migration

  • src/frontend/index.jsx — migrated to createRoot / root.render() / root.unmount()
  • src/frontend/Popover.jsx — migrated internal portal rendering to createRoot
  • All 6 playground entry points (baltimore, baltimore-hooks, casablanca, denmark, todo-6, todo-local-6) — migrated to createRoot

Deprecated lifecycle methods (10 occurrences across 6 files)

  • componentWillMount moved to constructor or componentDidMount in: DataItem.jsx, RichPanel.jsx, App.jsx, ContextMenu.jsx, injectStores.jsx
  • componentWillReceiveProps replaced with componentDidUpdate in: DataItem.jsx, ContextMenu.jsx
  • componentWillUpdate replaced with componentDidUpdate in: RichPanel.jsx, Popover.jsx, injectStores.jsx

ReactDOM.findDOMNode removal (3 occurrences in 2 files)

  • src/frontend/PreviewValue.jsx — replaced findDOMNode(this) with React.createRef() on root elements
  • src/frontend/Popover.jsx — replaced findDOMNode(this) with a triggerRef and wrapper <span style={{display:'contents'}}> to avoid layout impact

andykog added 6 commits June 16, 2026 19:13
- react-tiny-virtual-list was declared but never imported, and its peer
  dep (react 15.x || 16.x) blocks npm install with React 18
- bootstrap script still referenced lerna; use npm install --legacy-peer-deps
With both root and playground on React 18, npm workspaces hoists React
to root node_modules/. The hardcoded path.join(__dirname, 'node_modules/react')
no longer exists. Use require.resolve like the other aliases so it finds
React wherever npm installed it.
createRoot.render() is async in React 18 unlike React 15's
ReactDOM.render. The show() method needs the PopoverBubble ref
immediately after render to set content and attach event listeners.
Wrap in flushSync to guarantee the ref callback fires synchronously.
@andykog andykog marked this pull request as ready for review June 17, 2026 09:15
andykog added 4 commits June 17, 2026 12:16
The custom Popover had positioning bugs and missing arrows after the
React 18 upgrade. Replace it with @floating-ui/react which handles
positioning, flip/shift, arrow rendering, and click/hover/dismiss
interactions out of the box. This also eliminates the manual createRoot
portal and ContextProvider workaround since FloatingPortal preserves
React context natively.
…irst render

this.value was only set in componentDidMount (after first render), so
the initial render always displayed "undefined". For plain objects
without the inspected symbol, componentDidMount never called setState,
leaving the stale undefined visible until a user click triggered a
re-render.
@andykog andykog merged commit f6fc5a3 into master Jun 17, 2026
1 check passed
@andykog andykog deleted the chore/upgrade-react-18 branch June 17, 2026 10:31
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.

1 participant