Skip to content

Make a bit more progress towards upgrading to React 18

Axel Bocciarelli requested to merge towards-react-18 into main

This supersedes !450 (closed).

I spent the last couple of days trying, once again, to upgrade to React 18... but once again I can't get passed all the failing tests. I tried setting up Jest independently from Create React App in order to use the latest version; I tried installing all the latest version of the Testing Library packages; I tried refactoring various things in the app; ... I tried sooo many workarounds, but every time I change something, something else breaks for no clear reason. 😞

There's definitely a combination of:

  • Jest/Testing Library/React struggling to handle asynchronicity in a JSDOM environment — one example I encountered is components rendered with React.lazy() getting stuck on "Loading..."
  • tests leaking into one another — i.e. tests that pass when run on their own but not together (maybe something to do with all the singletons used for rendering the app, like Start and RestService and/or with the Redux/zustand stores or local/sessionStorage not being cleared properly 🤷)

In this MR, I bring some of the changes from !450 (closed) and fix various issues (notably with typing) that popped up at various times along my quest. I also upgrade two libraries mentioned in #103 that are now compatible with React 18.

We should have a chat about where to go next. We need to get past this one way or another so we can move forward in H5Web, but also for the long-term health of the Daiquiri UI project.

Edited by Axel Bocciarelli

Merge request reports