mirror of
https://github.com/The-Low-Code-Foundation/OpenNoodl.git
synced 2026-01-11 14:52:55 +01:00
2.8 KiB
2.8 KiB
TASK-002: React 19 UI Fixes - Changelog
2025-12-08
Investigation
- Identified root cause: Legacy React 17 APIs still in use after Phase 1 migration
- Found 3 files requiring migration:
nodegrapheditor.debuginspectors.js- UsesReactDOM.render()andunmountComponentAtNode()commentlayer.ts- Creates newcreateRoot()on every renderTextStylePicker.jsx- UsesReactDOM.render()andunmountComponentAtNode()
- Confirmed these errors cause all reported UI bugs (node picker, config panel, wire connectors)
Changes Made
nodegrapheditor.debuginspectors.js
- Before: Used
ReactDOM.render()at line 60,ReactDOM.unmountComponentAtNode()at line 64 - After: Migrated to React 18+
createRoot()API with proper root management
commentlayer.ts
- Before: Created new roots on every
_renderReact()call, causing React warnings - After: Check if roots exist before creating, reuse existing roots
TextStylePicker.jsx
- Before: Used
ReactDOM.render()andunmountComponentAtNode()in useEffect - After: Migrated to
createRoot()API with proper cleanup
Testing Notes
- Verified right-click node picker works
- Verified plus icon node picker positions correctly
- Verified node config panel appears
- Verified wire connectors can be dragged
- Verified no more React 19 API errors in console
Code Changes Summary
nodegrapheditor.debuginspectors.js:
- Changed import from
require('react-dom')torequire('react-dom/client') - Added
this.rootproperty to store React root reference render(): Now creates root only once withcreateRoot(), reuses for subsequent rendersdispose(): Usesthis.root.unmount()instead ofReactDOM.unmountComponentAtNode()
commentlayer.ts:
_renderReact(): Now checks if roots exist before callingcreateRoot()renderTo(): Properly resets roots tonullafter unmounting when switching divsdispose(): Added null checks before unmounting
TextStylePicker.jsx:
- Changed import from
ReactDOM from 'react-dom'to{ createRoot } from 'react-dom/client' useEffect: Creates local root withcreateRoot(), renders popup, unmounts in cleanup
nodegrapheditor.ts:
- Added
toolbarRoots: Root[]array to store toolbar React roots - Added
titleRoot: Root | nullfor the title bar root - Toolbar rendering now creates roots only once and reuses them
reset(): Properly unmounts all toolbar roots and title root
createnewnodepanel.ts:
- Added explicit
width: 800px; height: 600pxon container div before React renders - This fixes popup positioning since React 18's
createRoot()is async - PopupLayer measures dimensions immediately after appending, but async render hasn't finished
- With explicit dimensions, PopupLayer calculates correct centered position