Skip to content

chore(settings): Update to React 19 - #20963

Draft
xlisachan wants to merge 4 commits into
mainfrom
PAY-3887
Draft

chore(settings): Update to React 19#20963
xlisachan wants to merge 4 commits into
mainfrom
PAY-3887

Conversation

@xlisachan

@xlisachan xlisachan commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

This pull request

  • Dependencies

    • Upgrades react/react-dom from 18.3 to 19.0 and @types/react/@types/react-dom to v19
    • Updates react-markdown to v9 and rehype-raw to v7 to resolve vfile type mismatches
  • Payments

    • Migrates useFormState (from react-dom) to useActionState (from react) in payments-ui CouponForm
  • Settings

    • Replaces deprecated ReactDOM.render with createRoot in fxa-settings entrypoint
    • Adapts components for React 19 ref handling (no more forwardRef requirement) and stricter type checks
    • Updates test mocks and jest config for React 19 compatibility

Issue that this pull request solves

Closes: PAY-3887

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.

This comment was marked as resolved.

@xlisachan
xlisachan force-pushed the PAY-3633 branch 5 times, most recently from f719832 to fa7a3da Compare August 6, 2026 14:09
@xlisachan
xlisachan force-pushed the PAY-3887 branch 3 times, most recently from 3ea8a3a to 46d78ad Compare August 6, 2026 18:43
@xlisachan
xlisachan marked this pull request as ready for review August 6, 2026 19:44
@xlisachan
xlisachan requested a review from a team as a code owner August 6, 2026 19:44

@vpomerleau vpomerleau left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Initial comments, Claude-assisted review)

The navigate()-during-render migration is a lot of ground to cover, and pulling lazy into its own module fixes a real latent bug on the way.

Two things I'd want sorted first, both in the TOTP path — see SigninTotpCode/container.tsx and baseTokenCode.ts. I think they're the same remount approached from two sides.

Dependency notes that don't map onto a changed line:

  • @testing-library/react is still 15.0.6 — peers on react@^18 and pulls @types/react-dom@^18 against @types/react@19. Probably what's driving the JSX.Element churn here; bumping to ^16.3.0 and adding @types/react-dom to resolutions should help.
  • react is pinned to 19.0.8 but @types/react is 19.2.18 — types two minors ahead of runtime.
  • @testing-library/react-hooks and @material-ui/core have no importers left after this. Droppable.
  • @react-pdf/renderer 3→4 drops the layout/textkit pins and the new mock stubs the module out, so PDFs have no coverage on either side. Have you opened a generated one?

Also worth a look before this leaves draft: the PR body is still the template, and the RTL box is unchecked while the avatar zoom control becomes a native range input.

Comment thread packages/fxa-settings/src/pages/Signin/SigninTotpCode/container.tsx
Comment thread packages/functional-tests/pages/baseTokenCode.ts Outdated
Comment thread packages/fxa-settings/src/components/Settings/MfaGuard/index.tsx
Comment thread packages/fxa-settings/src/index.tsx Outdated
Comment thread packages/fxa-settings/src/lib/hooks/useTotpSetup/index.tsx Outdated
Comment thread packages/fxa-react/jest.config.js Outdated
Comment thread libs/payments/ui/src/lib/client/components/CouponForm/index.test.tsx Outdated
@xlisachan
xlisachan marked this pull request as draft August 6, 2026 21:23
@vpomerleau

This comment was marked as resolved.

Base automatically changed from PAY-3633 to main August 7, 2026 16:43
@vpomerleau

This comment was marked as resolved.

xlisachan and others added 4 commits August 7, 2026 13:38
Because:

- fxa-react/jest.config.js pointed at svg-transform.js, which this branch
  deleted, so fxa-react:test-unit failed Jest config validation before
  running a single test
- the replacement transformer lived in fxa-settings, so fxa-react and
  fxa-admin-panel reached into an app package for library test config

This commit:

- moves fileTransform.js to fxa-react/configs
- repoints fxa-react's jest.config.js, the shared rescripts config, and
  fxa-settings' Jest transform at the new location
Because:

- the timer, breadcrumb and new localized string guarded against the global
  redirect failing, which is a pre-existing assumption React 19 did not change
- hardening it needs UX copy and an l10n string, so it belongs in its own
  change rather than a dependency upgrade

This commit:

- reduces the INSUFFICIENT_AAL branch to a bare return; the comment already
  explains why onDismiss must be skipped
- clarifies the InputPhoneNumber comment: defaultValues seeds countryCode,
  setValue keeps it in sync

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 65 out of 67 changed files in this pull request and generated no new comments.

Suppressed comments (2)

packages/fxa-settings/src/components/InputText/index.tsx:146

  • inputRefDOM is typed as Ref<HTMLInputElement> (so callers can pass either an object ref or a callback ref), but combinedRef always treats it as an object ref by assigning .current. If a caller passes a callback ref, it will never be invoked (and the ref will not be set). Also, assigning .current via React.RefObject is fragile with React/@types typings.

Consider handling function refs explicitly and using MutableRefObject for the object-ref path (same for inputRef / RHF registration refs).

      if (inputRefDOM) {
        (inputRefDOM as React.RefObject<HTMLInputElement | null>).current =
          element;
      }
      const refToCall = registrationRefLatest.current || inputRef;

packages/fxa-settings/config/jest/reactPdfMock.js:8

  • config/jest/reactPdfMock.js was added, but there are no references to it in the repo (no moduleNameMapper, jest.mock path alias, or other import). As-is, it's dead code and its header comment about "@react-pdf/renderer v4" is also potentially misleading given fxa-settings is pinned/patching renderer 3.x.

Either wire this into Jest config (e.g., map @react-pdf/renderer to this file) or remove it to avoid carrying an unused mock implementation.

// @react-pdf/renderer v4 ships ESM-only, which Jest cannot import without
// transforming its entire transitive dependency tree. Since unit tests never
// exercise real PDF generation, we stub the module.

@vpomerleau

Copy link
Copy Markdown
Contributor

React19 is causing breaking changes for recovery key PDF generation. We'll need to find a solution (revert to serving the key in a text file or find an alternate PDF generator) to unblock the React 19 upgrade. I'm following up with product team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants