feat: ⬆️ Upgrade to React 19 - #8708
Conversation
|
@joshistoast @blessedcoolant I’m trying to place this on the release roadmap. What is the level of work needed to test this thoroughly and bring it out of the draft stage. I’ve currently slated it for v6.13.x, with an eta in 4-6 weeks; does that sound right? Could go in sooner if feasible. |
It is a much larger endeavor. React 19 introduced the React Compiler that auto memoizes to improve performance. It is optional but if we are upgrading we might as well make use of it. So that brings us to the fact that we use memoization manually almost across every single component in the app. We will have to refactor them all to permit the React Compiler to take over instead. This could introduce a ton of bugs that will need fixing. Not to mention, we will have to check the compatibility of our other dependencies and tools. I'd rather this be one slowly and carefully. There's no urgent rush for us to upgrade just yet but we should do it long term. It makes our lives much easier. On the list. But let's keep it under "whenever it feels good". |
|
I'm avoiding the text tool issues for now in order to not conflict with #9091 |
|
I kinda like that react is now smart enough to refuse a build if we've made bad choices |
don't think it's working rn but here it is
required also upgrading storybook and vitest
mostly updates refobject types to have null possibilities, and in some places made updates to mitigate some immediate react 19 rendering errors
- no hooks get called in loops anymore - effect starts async filter after render - updates state only after awaiting fetches - tracks cancellation - use sets for workflow ids
this can cause cascading re-renders, and is counted as an error to the react 19 recommended linting.
|
The skipped checks are... failing? EDIT: Ah, there was a higher priority job, rerunning... |
Adversarial Review: PR #8708 (React 19 upgrade)FindingsCritical: Text tool crash via Tooltip + Combobox in React 19File: Symptom: Selecting the Text tool in the canvas toolbar throws Root cause: The This is a real React 19 compatibility gap in Workaround applied: wrap the Other call sites of
Proper fix: the workaround is symptom-only. The cleaner path is one of (a) ship a React 19 compatible Tooltip in Test: to expose this in CI, add a test that mounts High: Double Redux rehydration in dev modeFiles:
Symptom: Every Redux slice logs Root cause: This PR moves Severity: dev-only loop, so not a release blocker on its own. However, if Test: to expose this, audit High: useFilteredWorkflows stuck
|
Findings
The PR removed the local const hex = rgbaToHex(color, true); // line 43, derived every render
...
<Input value={hex} onChange={onChangeHex} placeholder="#RRGGBB or #RRGGBBAA" w="10rem" /> // line 147
Evidence chain:
|
|
Fixed the above issue from @Pfannkuchensack that blocked editing the hex field. |
* feat: ⬆️ upgrade deps
* chore: ⬆️ upgrade `react` to `19.2`
* perf: ⚡ enable react compiler
don't think it's working rn but here it is
* feat: upgrade deps, configure compiler linting errors
* chore: upgrade vite to v8
required also upgrading storybook and vitest
* fix: react 19 upgrade migrations
mostly updates refobject types to have null possibilities, and in some places made updates to mitigate some
immediate react 19 rendering errors
* fix: dragHandleRef can be null
* perf: avoid cascading renders on `InvokeAIUI`
* perf(canvas): run workflows hook improvements
- no hooks get called in loops anymore
- effect starts async filter after render
- updates state only after awaiting fetches
- tracks cancellation
- use sets for workflow ids
* perf: refactors to avoid synchronous state setting in effects
this can cause cascading re-renders, and is counted as an error to the react 19 recommended linting.
* fix(api): run typegen
* fix: text tool effects usage
* fix: linting
* fix(compiler): properly wire up the react compiler
* fix: refactor compiler-incompatible component tests
The React Compiler emits `useMemoCache` calls into every component,
which crashed two tests that invoked components as plain functions (via
direct call or `.type`) outside React's render path.
Rather than disable the compiler for tests, extract the testable surface
so the tests no longer need to render:
- ImageMetadataActions: hoist the handler list to an exported
`IMAGE_METADATA_ACTION_HANDLERS` array and render via map +
type-guarded dispatch. Test asserts against the array.
- AddBoardButton: extract the async create-and-dispatch flow into
`createBoardAndDispatchActions`. Test exercises that function
directly with vi.fn() doubles.
- parsing.tsx: export `isCollectionMetadataHandler` and add
`isUnrecallableMetadataHandler` to support the map-based render.
* fix: linting
* chore: run typegen
* fix(canvas): wrap text line-height combobox tooltip child
* fix(app): keep rehydration bootstrap outside strict mode
* fix(canvas): clear workflow filtering state for empty lists
* fix(workflows): gate library render until view sync
* fix(canvas): keep model loading indicator across transitions
* fix(canvas): seed text overlay size from content metrics
* test(ui): restore null active tab navigation coverage
* fix(nodes): guard optional scheduler field
* fix(ui): handle optional metadata parser failures
* fix color picker hex value entry field
---------
Co-authored-by: joshistoast <me@joshcorbett.com>
Co-authored-by: Alexander Eichhorn <alex@eichhorn.dev>
Co-authored-by: dunkeroni <dunkeroni@gmail.com>
Summary
Upgrades
reactto version19.2. We can take this opportunity to rewrite the codebase in a way where we can lean on the compiler to remove a lot of verbosity from the components (e.g.displayName,memo(), etc.).Related Issues / Discussions
QA Instructions
Merge Plan
Checklist
What's Newcopy (if doing a release after this PR)