daniel-ac-martin / NotGovUK

An implementation of the GOV.UK Design System in React that provides support for writing internal applications in addition to public ones.
https://not-gov.uk/
MIT License
27 stars 8 forks source link

Update to React v18 #1044

Open daniel-ac-martin opened 2 weeks ago

daniel-ac-martin commented 2 weeks ago

Updates to React v18, which is a breaking change.

Note: This is a breaking change as consumer will have to update react and react-dom separately from our packages.

daniel-ac-martin commented 2 weeks ago

Unfortunately, this appears to break hydration. (It resorts to re-rendering from scratch.) This doesn't seem to happen under React v16. The error is a bit misleading (it complains about the first DOM element that is rendered, so matter what it is, even when the output is identical between client and server.)

cypress[bot] commented 2 weeks ago

NotGovUK    Run #5378

Run Properties:  status check failed Failed #5378  •  git commit 71108d500f: component-test-helpers: Update testing-library v14
Project NotGovUK
Branch Review react18
Run status status check failed Failed #5378
Run duration 12m 05s
Commit git commit 71108d500f: component-test-helpers: Update testing-library v14
Committer Daniel A.C. Martin
View all properties for this run ↗︎

Test results
Tests that failed  Failures 1
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 0
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.
View all changes introduced in this branch ↗︎


Tests for review

daniel-ac-martin commented 2 weeks ago

I wonder if it is something in the app-composer that causes this. (Previously the error indicated Suspense was the issue, and we were switching between Suspense and Fragment depending on client vs server. - As an aside, we should also consider using Suspense on both sides as it is supposed to support SSR now.)

There's also a possibility that upgrading one of the components in app-composer could fix this.