terminosaurus icon indicating copy to clipboard operation
terminosaurus copied to clipboard

React 19?

Open natew opened this issue 9 months ago • 3 comments
trafficstars

Probably annoying to support but we've moved to it and I'm getting this:

var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
                                             ^

TypeError: Cannot read properties of undefined (reading 'ReactCurrentOwner')
    at $$$reconciler (/Users/n8/one/node_modules/react-reconciler/cjs/react-reconciler.development.js:491:46)
    at sources/react/Reconciler.ts (/Users/n8/one/node_modules/terminosaurus/dist/react.js:11107:54)
    at __init (/Users/n8/one/node_modules/terminosaurus/dist/react.js:9:56)

natew avatar Feb 08 '25 03:02 natew

Looks like react-pdf bridged it in a nice way here:

https://github.com/diegomura/react-pdf/tree/master/packages/reconciler/src

natew avatar Feb 08 '25 03:02 natew

I made an attempt (https://github.com/arcanis/terminosaurus/pull/4) but it seems to break a fairly simple test case, so I'm not sure what to make of it considering the React team hasn't published any migration guide for reconciler authors 😕

arcanis avatar Feb 17 '25 12:02 arcanis

prepareUpdate was removed, and the update payload in commitUpdate as well. This is likely causing the breakage. You can see the shell types I implemented in react-three-fiber as a reference: https://github.com/pmndrs/react-three-fiber/blob/master/packages/fiber/src/core/reconciler.tsx#L71, and a very simple example: https://github.com/pmndrs/react-nil. If you want to support both, I would do feature detection to switch between the old/new commitUpdate signatures. Types can be breaking though. Make sure you access or augment JSX in module scope (it was global scope before), and you can support the latest 18+ and 19+ types. I've opted against this as reconciler behavior is very different from 18-19, and there are inherent bugs we need to combat and deviate as a result.

CodyJasonBennett avatar Feb 21 '25 10:02 CodyJasonBennett