Finished component sidebar updates, with one small bug remaining and documented

This commit is contained in:
Richard Osborne
2025-12-28 22:07:29 +01:00
parent 5f8ce8d667
commit fad9f1006d
193 changed files with 22245 additions and 506 deletions

View File

@@ -0,0 +1,420 @@
# TASK-001 Changelog
Track all changes made during this task. Update this file as you work.
---
## [2025-06-12] - Cline (AI-assisted)
### Summary
Fixed React 19 TypeScript compatibility errors that were preventing the build from completing. The previous developer updated dependencies but did not address all the TypeScript compatibility issues with the new `@types/react` package.
### Starting Point
- Based on branch: `12-upgrade-dependencies`
- Previous work by: previous developer
- Previous commits include:
- Package.json dependency updates (React 17 → 19)
- "Update rendering to use non-deprecated react-dom calls"
---
## React 19 TypeScript Fixes
### Issue 1: Unused `@ts-expect-error` directives
React 19's types fixed some underlying issues that were previously suppressed with `@ts-expect-error`. These now cause errors when the underlying issue no longer exists.
### Issue 2: `useRef()` requires explicit type parameter
In React 19's types, `useRef()` without a type parameter returns `RefObject<unknown>`, which is not assignable to more specific ref types.
**Fix**: Changed `useRef()` to `useRef<HTMLDivElement>(null)`
### Issue 3: `JSX` namespace moved
In React 19, `JSX` is no longer a global namespace. It must be accessed as `React.JSX`.
**Fix**: Changed `keyof JSX.IntrinsicElements` to `keyof React.JSX.IntrinsicElements`
### Issue 4: `ReactFragment` export removed
React 19 no longer exports `ReactFragment`. Use `Iterable<React.ReactNode>` instead.
### Issue 5: `children` not implicitly included in props
React 19 no longer implicitly includes `children` in component props. It must be explicitly declared.
**Fix**: Added `children?: React.ReactNode` to component prop interfaces.
### Issue 6: `ReactDOM.findDOMNode` removed
React 19 removed the deprecated `findDOMNode` API.
**Fix**: Access DOM elements directly from refs rather than using `findDOMNode`.
---
## Build Fixes
### Error: TS2578: Unused '@ts-expect-error' directive
- **Cause**: React 19 types fixed the type inference for `React.cloneElement()`
- **Fix**: Removed the `@ts-expect-error` comment
- **Files**:
- `packages/noodl-core-ui/src/components/layout/Columns/Columns.tsx`
- `packages/noodl-viewer-react/src/components/visual/Columns/Columns.tsx`
### Error: TS2554: Expected 1 arguments, but got 0 (useRef)
- **Cause**: React 19's types require an initial value for `useRef()`
- **Fix**: Added type parameter and null initial value: `useRef<HTMLDivElement>(null)`
- **Files**:
- `packages/noodl-core-ui/src/components/app/SideNavigation/SideNavigation.tsx`
- `packages/noodl-core-ui/src/components/popups/ContextMenu/ContextMenu.tsx`
### Error: TS2322: RefObject<unknown> not assignable to RefObject<HTMLElement>
- **Cause**: Untyped `useRef()` returns `RefObject<unknown>`
- **Fix**: Same as above - add explicit type parameter
- **Files**: Same as above
### Error: TS2305: Module 'react' has no exported member 'ReactFragment'
- **Cause**: `ReactFragment` was removed in React 19
- **Fix**: Replaced with `Iterable<React.ReactNode>`
- **File**: `packages/noodl-viewer-react/src/types.ts`
### Error: TS2503: Cannot find namespace 'JSX'
- **Cause**: `JSX` is no longer a global namespace in React 19
- **Fix**: Changed `JSX.IntrinsicElements` to `React.JSX.IntrinsicElements`
- **Files**:
- `packages/noodl-viewer-react/src/components/visual/Group/Group.tsx`
- `packages/noodl-viewer-react/src/components/visual/Text/Text.tsx`
### Error: TS2339: Property 'children' does not exist on type
- **Cause**: React 19 no longer implicitly includes `children` in props
- **Fix**: Added `children?: React.ReactNode` to component interfaces
- **Files**:
- `packages/noodl-viewer-react/src/components/visual/Drag/Drag.tsx`
- `packages/noodl-viewer-react/src/components/visual/Group/Group.tsx`
### Error: Property 'findDOMNode' does not exist on ReactDOM
- **Cause**: `findDOMNode` removed from React 19
- **Fix**: Access DOM element directly from ref instead of using findDOMNode
- **File**: `packages/noodl-viewer-react/src/components/visual/Group/Group.tsx`
---
## Files Modified
- [x] `packages/noodl-core-ui/src/components/layout/Columns/Columns.tsx`
- [x] `packages/noodl-core-ui/src/components/app/SideNavigation/SideNavigation.tsx`
- [x] `packages/noodl-core-ui/src/components/popups/ContextMenu/ContextMenu.tsx`
- [x] `packages/noodl-viewer-react/src/types.ts`
- [x] `packages/noodl-viewer-react/src/components/visual/Columns/Columns.tsx`
- [x] `packages/noodl-viewer-react/src/components/visual/Drag/Drag.tsx`
- [x] `packages/noodl-viewer-react/src/components/visual/Group/Group.tsx`
- [x] `packages/noodl-viewer-react/src/components/visual/Text/Text.tsx`
---
## Files Created
- None
---
## Files Deleted
- None
---
## Breaking Changes
- React 19 requires Node.js 18+ (documented in root package.json engines)
- `findDOMNode` usage removed - code now accesses refs directly
---
## Testing Notes
### Automated Tests
- `npm run dev`: **PASS** - All three packages (Editor, Viewer, Cloud) compile successfully
### Manual Tests
- Dev server start: **PASS** - Editor launches, Viewer compiles, Cloud compiles
---
## Known Issues
<!-- Document any issues discovered that aren't fixed in this task -->
1. Deprecation warnings for Sass legacy JS API - Non-blocking, can be addressed in future task
2. Deprecation warning for `Buffer()` - Non-blocking, comes from dependency
---
## Follow-up Tasks
1. Consider updating Sass configuration to use modern API - Future task
2. Review `scrollToElement` functionality to ensure it works correctly with the new ref-based approach - Manual testing needed
---
## Final Summary
**Total files modified**: 8
**Build status**: All packages compiling successfully (was 95 errors, now 0)
**Confidence**: 8/10 (code compiles, but manual testing of `scrollToElement` functionality recommended)
---
## [2025-12-07] - Cline (AI-assisted) - P0 Critical Items from TASK-000 Analysis
### Summary
Completed the P0 critical items identified in the TASK-000 dependency analysis:
1. Fixed Storybook scripts and dependencies in noodl-core-ui
2. Standardized TypeScript version across packages
---
## P0 Item 1: Fix Storybook in noodl-core-ui
### Issue
- Old Storybook CLI commands (`start-storybook`, `build-storybook`) were being used
- Missing framework-specific packages required for Storybook 8.x
- Configuration file (`main.ts`) using deprecated format
### Changes Made
#### package.json scripts update
```json
// OLD
"start": "start-storybook -p 6006 -s public",
"build": "build-storybook -s public"
// NEW
"start": "storybook dev -p 6006",
"build": "storybook build"
```
#### Added Storybook dependencies
- `@storybook/addon-essentials`: ^8.6.14
- `@storybook/addon-interactions`: ^8.6.14
- `@storybook/addon-links`: ^8.6.14
- `@storybook/addon-measure`: ^8.6.14
- `@storybook/react`: ^8.6.14
- `@storybook/react-webpack5`: ^8.6.14
- Updated `storybook` from ^9.1.3 to ^8.6.14 (version consistency)
#### Updated `.storybook/main.ts`
- Changed from CommonJS (`module.exports`) to ES modules (`export default`)
- Added proper TypeScript typing with `StorybookConfig`
- Updated framework config from deprecated `core.builder` to modern `framework.name` format
- Kept custom webpack aliases for editor integration
**Files Modified**:
- `packages/noodl-core-ui/package.json`
- `packages/noodl-core-ui/.storybook/main.ts`
---
## P0 Item 2: Standardize TypeScript Version
### Issue
- `packages/noodl-viewer-react` was using TypeScript ^5.1.3
- Rest of the monorepo (root, noodl-core-ui, noodl-editor) uses ^4.9.5
- Version mismatch can cause type compatibility issues
### Fix
Changed `packages/noodl-viewer-react/package.json`:
```json
// OLD
"typescript": "^5.1.3"
// NEW
"typescript": "^4.9.5"
```
**File Modified**:
- `packages/noodl-viewer-react/package.json`
---
## Validation
### Build Test
- `npm run build:editor:_viewer`: **PASS**
- Viewer builds successfully with TypeScript 4.9.5
### Install Test
- `npm install`: **PASS**
- No peer dependency errors
- All Storybook packages installed correctly
---
## Additional Files Modified (P0 Session)
- [x] `packages/noodl-core-ui/package.json` - Scripts + Storybook dependencies
- [x] `packages/noodl-core-ui/.storybook/main.ts` - Modern Storybook 8 config
- [x] `packages/noodl-viewer-react/package.json` - TypeScript version alignment
---
## Notes
### Storybook Version Discovery
The `storybook` CLI package uses different versioning than `@storybook/*` packages:
- `storybook` CLI: 9.1.3 exists but is incompatible with 8.x addon packages
- `@storybook/addon-*`: Latest stable is 8.6.14
- Solution: Use consistent 8.6.14 across all Storybook packages
### TypeScript Version Decision
- Chose to standardize on 4.9.5 (matching majority) rather than upgrade all to 5.x
- TypeScript 5.x upgrade can be done in a future task with proper testing
- This ensures consistency without introducing new breaking changes
---
## [2025-07-12] - Cline (AI-assisted) - P1 High Priority Items from TASK-000 Analysis
### Summary
Completed the P1 high priority items identified in the TASK-000 dependency analysis:
1. Updated webpack plugins in noodl-viewer-react (copy-webpack-plugin, clean-webpack-plugin, webpack-dev-server)
2. Aligned css-loader and style-loader versions
3. Updated Jest to v29 across packages
4. Updated copy-webpack-plugin in noodl-viewer-cloud
---
## P1.1: Update Webpack Plugins in noodl-viewer-react
### Dependencies Updated
| Package | Old Version | New Version |
|---------|-------------|-------------|
| clean-webpack-plugin | ^1.0.1 | ^4.0.0 |
| copy-webpack-plugin | ^4.6.0 | ^12.0.2 |
| webpack-dev-server | ^3.11.2 | ^4.15.2 |
| css-loader | ^5.0.0 | ^6.11.0 |
| style-loader | ^2.0.0 | ^3.3.4 |
| jest | ^28.1.0 | ^29.7.0 |
| ts-jest | ^28.0.3 | ^29.4.1 |
| @types/jest | ^27.5.2 | ^29.5.14 |
### Webpack Config Changes Required
#### Breaking Change: clean-webpack-plugin v4
- Old API: `new CleanWebpackPlugin(outputPath, { allowExternal: true })`
- New API: Uses webpack 5's built-in `output.clean: true` option
- Import changed from `require('clean-webpack-plugin')` to `const { CleanWebpackPlugin } = require('clean-webpack-plugin')`
#### Breaking Change: copy-webpack-plugin v12
- Old API: `new CopyWebpackPlugin([patterns])`
- New API: `new CopyWebpackPlugin({ patterns: [...] })`
- `transformPath` option removed, use `to` function instead
- Added `info: { minimized: true }` to prevent Terser from minifying copied JS files
**Files Modified**:
- `packages/noodl-viewer-react/webpack-configs/webpack.viewer.common.js`
- `packages/noodl-viewer-react/webpack-configs/webpack.deploy.common.js`
- `packages/noodl-viewer-react/webpack-configs/webpack.ssr.common.js`
### Webpack Config Migration Example
```javascript
// OLD (v4.6.0)
const CleanWebpackPlugin = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
new CleanWebpackPlugin(outputPath, { allowExternal: true }),
new CopyWebpackPlugin([
{
from: 'static/shared/**/*',
transformPath: (targetPath) => stripStartDirectories(targetPath, 2)
}
])
// NEW (v12.0.2)
const CopyWebpackPlugin = require('copy-webpack-plugin');
// output.clean: true in config
output: {
clean: true
},
new CopyWebpackPlugin({
patterns: [
{
from: 'static/shared',
to: '.',
noErrorOnMissing: true,
info: { minimized: true }
}
]
})
```
---
## P1.2: Update copy-webpack-plugin in noodl-viewer-cloud
### Dependencies Updated
| Package | Old Version | New Version |
|---------|-------------|-------------|
| copy-webpack-plugin | ^4.6.0 | ^12.0.2 |
| clean-webpack-plugin | (not present) | ^4.0.0 |
**Files Modified**:
- `packages/noodl-viewer-cloud/package.json`
- `packages/noodl-viewer-cloud/webpack-configs/webpack.viewer.common.js`
---
## Build Issue: Terser Minification of Copied Files
### Problem
When using copy-webpack-plugin v12 with webpack 5 production mode, Terser tries to minify all JS files in the output directory, including copied static files. This caused errors because some copied JS files contained modern syntax.
### Solution
Added `info: { minimized: true }` to CopyWebpackPlugin patterns to tell webpack these files are already minimized and should not be processed by Terser.
```javascript
{
from: 'static/deploy',
to: '.',
noErrorOnMissing: true,
info: { minimized: true } // <-- Prevents Terser processing
}
```
---
## Validation
### Build Test
- `npm run build:editor:_viewer`: **PASS**
- All three viewer builds (viewer, deploy, ssr) complete successfully
### Install Test
- `npm install`: **PASS**
- Net reduction of 197 packages (removed 214 old, added 17 new)
---
## Files Modified (P1 Session)
### noodl-viewer-react
- [x] `packages/noodl-viewer-react/package.json` - All dependency updates
- [x] `packages/noodl-viewer-react/webpack-configs/webpack.viewer.common.js`
- [x] `packages/noodl-viewer-react/webpack-configs/webpack.deploy.common.js`
- [x] `packages/noodl-viewer-react/webpack-configs/webpack.ssr.common.js`
### noodl-viewer-cloud
- [x] `packages/noodl-viewer-cloud/package.json`
- [x] `packages/noodl-viewer-cloud/webpack-configs/webpack.viewer.common.js`
---
## Summary
**P0 + P1 Total files modified**: 14
**Build status**: All packages building successfully ✅
**Packages reduced**: 197 (cleaner dependency tree with modern versions)
### Dependency Modernization Benefits
- Modern plugin APIs with better webpack 5 integration
- Smaller bundle sizes with newer optimizers
- Better support for ES modules and modern JS
- Consistent Jest 29 across all packages
- Removed deprecated clean-webpack-plugin API

View File

@@ -0,0 +1,123 @@
# TASK-001 Checklist
## Prerequisites
- [ ] Read README.md completely
- [ ] Understand React 19 breaking changes
- [ ] Have Node.js 18+ installed
- [ ] Clone the repository fresh (or ensure clean state)
## Phase 1: Setup
- [ ] Checkout existing work: `git checkout 12-upgrade-dependencies`
- [ ] Create task branch: `git checkout -b task/001-dependency-updates`
- [ ] Delete node_modules: `rm -rf node_modules packages/*/node_modules`
- [ ] Clean install: `npm install`
- [ ] Document any install errors in NOTES.md
- [ ] Note: confidence level for this phase: __/10
## Phase 2: Dependency Conflicts
- [ ] List all peer dependency warnings
- [ ] Research each warning
- [ ] Fix conflicts in root package.json
- [ ] Fix conflicts in packages/noodl-editor/package.json
- [ ] Fix conflicts in packages/noodl-core-ui/package.json
- [ ] Fix conflicts in packages/noodl-viewer-react/package.json
- [ ] Fix conflicts in other packages as needed
- [ ] Verify clean `npm install`
- [ ] Document fixes in CHANGELOG.md
- [ ] Note: confidence level for this phase: __/10
## Phase 3: Build Errors
- [ ] Run `npm run build:editor`
- [ ] List all build errors
- [ ] Fix error 1: _______________
- [ ] Fix error 2: _______________
- [ ] Fix error 3: _______________
- [ ] (add more as needed)
- [ ] Verify clean build
- [ ] Document fixes in CHANGELOG.md
- [ ] Note: confidence level for this phase: __/10
## Phase 4: React 19 Migration
- [ ] Search for ReactDOM.render usage:
```bash
grep -rn "ReactDOM.render" packages/ --include="*.ts" --include="*.tsx" --include="*.js"
```
- [ ] List all files found: _______________
- [ ] Update file 1: _______________
- [ ] Update file 2: _______________
- [ ] (add more as needed)
- [ ] Search for ReactDOM.hydrate usage
- [ ] Search for ReactDOM.unmountComponentAtNode usage
- [ ] Update any found
- [ ] Verify no legacy ReactDOM usage remains
- [ ] Document changes in CHANGELOG.md
- [ ] Note: confidence level for this phase: __/10
## Phase 5: react-instantsearch Migration
- [ ] Open `packages/noodl-editor/src/editor/src/views/HelpCenter/HelpCenter.tsx`
- [ ] Update import from `react-instantsearch-hooks-web` to `react-instantsearch`
- [ ] Check all hooks used are still available
- [ ] Search for other files using old package:
```bash
grep -rn "react-instantsearch-hooks-web" packages/
```
- [ ] Update any other files found
- [ ] Test search functionality works
- [ ] Document changes in CHANGELOG.md
- [ ] Note: confidence level for this phase: __/10
## Phase 6: Build Optimization (Optional but Recommended)
- [ ] Measure current build time: ___ seconds
- [ ] Check webpack config for cache settings
- [ ] Enable persistent caching if not enabled
- [ ] Check for unnecessary rebuilds
- [ ] Measure new build time: ___ seconds
- [ ] Document optimizations in CHANGELOG.md
## Phase 7: Testing - Automated
- [ ] Run `npm run test:editor`
- [ ] All tests pass
- [ ] Note any failures: _______________
- [ ] Run `npm run test:platform`
- [ ] All tests pass
- [ ] Note any failures: _______________
- [ ] Run `npx tsc --noEmit`
- [ ] No TypeScript errors
- [ ] Note any errors: _______________
## Phase 8: Testing - Manual
- [ ] Start dev server: `npm run dev`
- [ ] Starts without errors
- [ ] No console warnings about deprecated APIs
- [ ] Create new project
- [ ] Add Group node to canvas
- [ ] Add Text node as child
- [ ] Connect nodes
- [ ] Open preview
- [ ] Edit text content, verify preview updates
- [ ] Save and reopen project
- [ ] Open Help Center, test search (react-instantsearch)
- [ ] Edit Function node code
- [ ] Change a file, verify hot reload works
- [ ] Build production: `npm run build:editor`
## Phase 9: Cleanup & Documentation
- [ ] Remove any debug console.logs added
- [ ] Review all changes for code quality
- [ ] Complete CHANGELOG.md with summary
- [ ] Update NOTES.md with learnings
- [ ] Self-review: confidence level __/10
## Phase 10: Completion
- [ ] All success criteria met (see README.md)
- [ ] Create pull request
- [ ] PR title: "TASK-001: Dependency Updates & Build Modernization"
- [ ] PR description includes:
- [ ] Summary of changes
- [ ] Testing performed
- [ ] Any known issues or follow-ups
- [ ] Mark task complete
## Final Confidence Check
- Overall confidence this task is complete and correct: __/10
- Remaining concerns: _______________

View File

@@ -0,0 +1,128 @@
# TASK-001 Working Notes
## Research
### Previous Developer's Work
**Branch**: `12-upgrade-dependencies`
**Commits found**:
1. Package.json updates across all packages
2. "Update rendering to use non-deprecated react-dom calls"
**What they changed**:
- React 17.0.2 → 19.0.0
- react-instantsearch-hooks-web → react-instantsearch
- Removed deprecated react-json-view, added @microlink/react-json-view
- Updated webpack 5.74.0 → 5.101.3
- Removed Node.js upper version cap (was <=18, now 16+)
- Removed Storybook 6.x packages
### React 19 Breaking Changes to Watch For
1. **Automatic Batching** - State updates are now automatically batched
2. **Concurrent Features** - May affect node graph rendering timing
3. **Strict Mode** - Double-renders effects for cleanup detection
4. **Removed APIs**:
- `ReactDOM.render()``createRoot()`
- `ReactDOM.hydrate()``hydrateRoot()`
- `ReactDOM.unmountComponentAtNode()``root.unmount()`
### react-instantsearch Changes
The package was renamed from `react-instantsearch-hooks-web` to `react-instantsearch`.
Most APIs are compatible, but verify:
- `useHits`
- `useSearchBox`
- `InstantSearch` component props
### Files to Search
```bash
# Find ReactDOM.render usage
grep -rn "ReactDOM.render" packages/ --include="*.ts" --include="*.tsx" --include="*.js"
# Find old instantsearch imports
grep -rn "react-instantsearch-hooks-web" packages/
# Find any remaining TSFixme (for awareness, not this task)
grep -rn "TSFixme" packages/ --include="*.ts" --include="*.tsx"
```
---
## Assumptions
- [ ] Previous dev's changes are on `12-upgrade-dependencies` branch - **VERIFY**
- [ ] Build was working before their changes - **VERIFY by checking main**
- [ ] No other branches need to be merged first - **VERIFY**
---
## Implementation Notes
### Approach Decisions
[To be filled in during work]
### Gotchas / Surprises
[To be filled in during work]
---
## Debug Log
### [Date/Time]
- **Trying**: [what you're attempting]
- **Result**: [what happened]
- **Next**: [what to try next]
---
## Useful Commands
```bash
# Clean install
rm -rf node_modules packages/*/node_modules
npm install
# Build editor
npm run build:editor
# Run tests
npm run test:editor
# Type check
npx tsc --noEmit
# Start dev server
npm run dev
# Find files with pattern
grep -rn "pattern" packages/ --include="*.ts" --include="*.tsx"
# Check git status
git status
git diff --stat
# Compare with main
git diff main..HEAD --stat
```
---
## Questions to Resolve
- [ ] Are there any other branches that should be merged first?
- [ ] Did the previous dev test the build?
- [ ] Are there any known issues documented anywhere?
---
## Links & Resources
- [React 19 Blog Post](https://react.dev/blog/2024/04/25/react-19)
- [React 19 Upgrade Guide](https://react.dev/blog/2024/04/25/react-19-upgrade-guide)
- [react-instantsearch Migration](https://www.algolia.com/doc/guides/building-search-ui/upgrade-guides/react/)

View File

@@ -0,0 +1,241 @@
# TASK-001: Dependency Updates & Build Modernization
## Metadata
| Field | Value |
|-------|-------|
| **ID** | TASK-001 |
| **Phase** | Phase 1 - Foundation |
| **Priority** | 🔴 Critical |
| **Difficulty** | 🟡 Medium |
| **Estimated Time** | 2-3 days |
| **Prerequisites** | None (this is the first task) |
| **Branch** | `task/001-dependency-updates` |
| **Related Branches** | `12-upgrade-dependencies` (previous dev work) |
## Objective
Complete and validate all dependency updates, fully migrate to React 19, and modernize the build pipeline for reliable, fast development.
## Background
A previous developer started this work on the `12-upgrade-dependencies` branch. They updated package.json files across the monorepo, including:
- React 17 → 19
- Various webpack, typescript, and tooling updates
- Removed Node.js version upper cap
They also made a commit "Update rendering to use non-deprecated react-dom calls" which addressed some React 19 breaking changes.
This task completes that work, validates everything works, and improves the overall build experience.
## Current State
### What Exists
- Branch `12-upgrade-dependencies` with package.json updates
- Some React 19 migration work done
- Build may have errors or warnings
### Known Issues
- `react-instantsearch-hooks-web` renamed to `react-instantsearch` (breaking API change)
- `ReactDOM.render()` deprecated in React 18+
- Potential peer dependency conflicts
- Hot reload may be unreliable
- Build times are slow
### Key Package Changes (from previous dev)
| Package | Old | New | Breaking Changes |
|---------|-----|-----|------------------|
| react | 17.0.2 | 19.0.0 | Yes - see below |
| react-dom | 17.0.0 | 19.0.0 | Yes - render API |
| react-instantsearch-hooks-web | 6.38.0 | react-instantsearch 7.16.2 | Yes - renamed |
| webpack | 5.74.0 | 5.101.3 | Minor |
| typescript | 4.8.3 | 4.9.5 | Minor |
## Desired State
After this task:
- All packages build without errors
- No deprecation warnings in console
- React 19 fully adopted (no legacy patterns)
- Hot reload works reliably
- Build completes in <60 seconds
- All existing tests pass
## Scope
### In Scope
- [x] Validate and fix dependency updates
- [x] Complete React 19 migration
- [x] Fix all build errors and warnings
- [x] Update react-instantsearch usage
- [x] Improve build performance
- [x] Fix hot reload issues
### Additional Items from TASK-000 Analysis
Based on [TASK-000 Dependency Analysis](../TASK-000-dependency-analysis/README.md), the following items should be added:
#### 🔴 P0 - Critical (Added) ✅ COMPLETED
- [x] **Fix Storybook scripts in noodl-core-ui** - Updated to Storybook 8.6.14 with modern CLI commands
- [x] **Standardize TypeScript version** - noodl-viewer-react updated to 4.9.5 to match rest of monorepo
#### 🟡 P1 - High Priority (Added) ✅ COMPLETED
- [x] Update webpack plugins in noodl-viewer-react:
- [x] copy-webpack-plugin 4.6.0 → 12.0.2
- [x] clean-webpack-plugin 1.0.1 → 4.0.0 (replaced with output.clean)
- [x] webpack-dev-server 3.11.2 → 4.15.2
- [x] Align css-loader (5.0.0 → 6.11.0) and style-loader (2.0.0 → 3.3.4) in noodl-viewer-react
- [x] Update Jest to v29 across all packages (jest 29.7.0, ts-jest 29.4.1, @types/jest 29.5.14)
- [x] Update copy-webpack-plugin in noodl-viewer-cloud (4.6.0 → 12.0.2)
#### 🟢 P2 - Nice to Have ✅ COMPLETED
- [x] Update @types/react (19.0.0 → 19.2.7) and @types/react-dom (19.0.0 → 19.2.3)
- [x] Update Babel packages to latest patch versions (already at latest: 7.28.3/7.27.1)
### Out of Scope
- Major refactoring (that's later tasks)
- New features
- TSFixme cleanup (TASK-002)
- ESLint 9 migration (significant config changes required)
- Electron upgrade (31 → 39 requires separate planning)
- Express 5.x migration (breaking changes)
- Dugite 3.0 upgrade (breaking API changes)
## Technical Approach
### Key Files to Modify
| File | Changes |
|------|---------|
| `package.json` (root) | Verify dependencies, fix conflicts |
| `packages/*/package.json` | Verify peer deps, fix conflicts |
| `packages/noodl-editor/src/editor/src/views/HelpCenter/HelpCenter.tsx` | Update react-instantsearch imports |
| Any file with `ReactDOM.render` | Migrate to createRoot |
| `packages/noodl-viewer-react/` | React 19 compatibility |
### React 19 Migration Points
```typescript
// OLD (React 17)
import ReactDOM from 'react-dom';
ReactDOM.render(<App />, document.getElementById('root'));
// NEW (React 19)
import { createRoot } from 'react-dom/client';
const root = createRoot(document.getElementById('root'));
root.render(<App />);
```
Search for these patterns:
```bash
grep -r "ReactDOM.render" packages/ --include="*.ts" --include="*.tsx" --include="*.js"
grep -r "ReactDOM.hydrate" packages/ --include="*.ts" --include="*.tsx" --include="*.js"
grep -r "ReactDOM.unmountComponentAtNode" packages/ --include="*.ts" --include="*.tsx" --include="*.js"
```
### react-instantsearch Migration
```typescript
// OLD
import { InstantSearch, Hits } from 'react-instantsearch-hooks-web';
// NEW
import { InstantSearch, Hits } from 'react-instantsearch';
```
The API is mostly compatible, but verify all hooks used still exist.
## Implementation Steps
### Step 1: Setup and Initial Validation
1. Checkout the existing branch: `git checkout 12-upgrade-dependencies`
2. Create our task branch: `git checkout -b task/001-dependency-updates`
3. Clean install: `rm -rf node_modules && npm install`
4. Document any install errors in NOTES.md
### Step 2: Fix Dependency Conflicts
1. Run `npm install` and note all peer dependency warnings
2. For each warning, determine the correct resolution
3. Update package.json files as needed
4. Repeat until `npm install` runs cleanly
### Step 3: Fix Build Errors
1. Run `npm run build:editor`
2. Fix each error one at a time
3. Document each fix in CHANGELOG.md
4. Repeat until build succeeds
### Step 4: React 19 Migration
1. Search for deprecated ReactDOM calls
2. Update each to use createRoot pattern
3. Check for class component lifecycle issues
4. Test each changed component
### Step 5: react-instantsearch Update
1. Update imports in HelpCenter.tsx
2. Verify all hooks/components still available
3. Test search functionality
### Step 6: Build Optimization
1. Analyze current build time
2. Check webpack configs for optimization opportunities
3. Enable caching if not already
4. Measure improvement
### Step 7: Validation
1. Run full test suite
2. Manual testing of key workflows
3. Verify hot reload works
4. Check for console warnings
## Testing Plan
### Automated Tests
- [ ] Run `npm run test:editor` - all pass
- [ ] Run `npm run test:platform` - all pass
- [ ] Run `npx tsc --noEmit` - no type errors
### Manual Testing Scenarios
- [ ] Start dev server: `npm run dev` - starts without errors
- [ ] Create new project - works
- [ ] Add nodes to canvas - works
- [ ] Connect nodes - works
- [ ] Preview project - works
- [ ] Edit code in Function node - works
- [ ] Hot reload when editing - works
- [ ] Search in Help Center - works (react-instantsearch)
- [ ] Build for production - works
## Success Criteria
- [ ] `npm install` completes with no errors
- [ ] `npm run build:editor` completes with no errors
- [ ] `npm run test:editor` all tests pass
- [ ] `npx tsc --noEmit` no TypeScript errors
- [ ] No deprecation warnings in browser console
- [ ] Hot reload works reliably
- [ ] All manual test scenarios pass
## Risks & Mitigations
| Risk | Mitigation |
|------|------------|
| React 19 breaks something subtle | Extensive manual testing, rollback plan ready |
| react-instantsearch API changes | Read migration guide, test search thoroughly |
| Build time regression | Measure before/after, optimize if needed |
| Peer dependency hell | Use `--legacy-peer-deps` as last resort, document why |
## Rollback Plan
If major issues discovered:
1. Checkout main branch
2. Cherry-pick any non-breaking fixes
3. Document issues for future attempt
4. Consider incremental approach (React 18 first, then 19)
## References
- [React 19 Release Notes](https://react.dev/blog/2024/04/25/react-19)
- [react-instantsearch v7 Migration](https://www.algolia.com/doc/guides/building-search-ui/upgrade-guides/react/)
- Previous dev branch: `12-upgrade-dependencies`
- Previous dev commit: "Update rendering to use non-deprecated react-dom calls"