parabol icon indicating copy to clipboard operation
parabol copied to clipboard

Upgrade React to v18

Open mattkrick opened this issue 11 months ago • 1 comments

See #8340

Upgrading Relay didn't fix all the frontend errors. In dev, I see the following error pop up:

warning.js:30 Warning: Relay: Expected to have been able to read non-null data for fragment `ReactjiCount_reactji` declared in `useFragment()`, since fragment reference was non-null. Make sure that that `useFragment()`'s parent isn't holding on to and/or 
passing a fragment reference for data that has been deleted.

This is triggered by any component using the initial render or transition children. See https://github.com/ParabolInc/parabol/blob/09b38548e65efc5ad14c3c68a2d223fe4cbb4a1e/packages/client/components/ReflectionCard/ReactjiSection.tsx

React v18 was released 2 years ago. Now that React v19 has been released, it feels very safe to upgrade to v18. The only problem is the time it takes to upgrade.

Benefits:

  • we can use modern libraries (e.g. motion, next version of relay, etc)
  • v18 is maintained & bugs are fixed, etc
  • fewer bugs & write less hacky code
  • can write components faster by using newer libraries instead of writing big hacky workarounds without those libraries
  • the sooner we do it, the smaller the job will be

Estimated effort: 1 - 2 weeks

mattkrick avatar Nov 12 '24 16:11 mattkrick