Skip to content

Miscellaneous React 19 cleanups - #53326

Open
anomiex wants to merge 2 commits into
trunkfrom
fix/misc-react-19-stuff
Open

anomiex wants to merge 2 commits into
trunkfrom
fix/misc-react-19-stuff

Conversation

@anomiex

@anomiex anomiex commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Proposed changes

A bunch of one-off fixes:

  • ai-client: onInput is an InputEvent, not a ChangeEvent.
  • charts: FC<> now wants to allow for returning async, which the places we use renderLabel and renderLabelPopover can't actually handle. So declare their types without the FC<> helper.
  • charts: React 19 recognizes popoverTarget and popoverTargetAction, and rejects popovertarget and popovertargetaction, while React 18 needs the latter as it doesn't recognize the former. So supply whichever is appropriate at runtime based on the React version.
  • components: React 19 wants transformOrigin, while 18 needs transform-origin. It turns out there are no transforms anymore needing an origin in the first place, so just remove it.
  • backup: The useRestore test was advancing jest's fake timer by a large amount. React 19 doesn't like this: it doesn't get a gap between updates and winds up throwing a "Maximum update depth exceeded" error. Advance in steps of POLL_INTERVAL_MS instead, which gives React 19 the gaps it needs.
  • publicize: The ManageConnectionsModal test breaks in React 19. Using await jest.runAllTimersAsync() instead of jest.runAllTimers() in the already-async act() call fixes this.
  • videopress: Fix another argless useRef added since Update argless useRef() calls for React 19 #53002 fixed all the rest. Sigh.
  • jetpack: An AI admin page test was looking for the "Writing Assistant" checkbox synchronously, even though it gets added asynchronously and all the other tests look for it async. Somehow this worked ok in React 18, but breaks in 19; looking async like everything else does fixes it.

Related product discussion/links

p1790371023187659-slack-C05Q5HSS013

Does this pull request change what data or activity we track or use?

No

Testing instructions

  • CI happy?
  • Stuff still works?

A bunch of one-off fixes:

* ai-client: onInput is an `InputEvent`, not a `ChangeEvent`.
* charts: `FC<>` now wants to allow for returning async, which the
  places we use `renderLabel` and `renderLabelPopover` can't actually
  handle. So declare their types without the `FC<>` helper.
* charts: React 19 recognizes `popoverTarget` and `popoverTargetAction`,
  and rejects `popovertarget` and `popovertargetaction`, while React 18
  needs the latter as it doesn't recognize the former. So supply whichever
  is appropriate at runtime based on the React version.
* components: React 19 wants `transformOrigin`, while 18 needs
  `transform-origin`. It turns out there are no transforms anymore
  needing an origin in the first place, so just remove it.
* backup: The `useRestore` test was advancing jest's fake timer by a
  large amount. React 19 doesn't like this: it doesn't get a gap between
  updates and winds up throwing a "Maximum update depth exceeded" error.
  Advance in steps of `POLL_INTERVAL_MS` instead, which gives React 19 the
  gaps it needs.
* publicize: The `ManageConnectionsModal` test breaks in React 19. Using
  `await jest.runAllTimersAsync()` instead of `jest.runAllTimers()` in
  the already-async `act()` call fixes this.
* videopress: Fix another argless `useRef` added since #53002 fixed all
  the rest. Sigh.
* jetpack: An `AI admin page` test was looking for the "Writing
  Assistant" checkbox synchronously, even though it gets added
  asynchronously and all the other tests look for it async. Somehow this
  worked ok in React 18, but breaks in 19; looking async like everything
  else does fixes it.
@anomiex
anomiex requested a review from a team October 7, 2026 19:35
@anomiex anomiex self-assigned this Oct 7, 2026
@anomiex anomiex added [Status] Needs Review This PR is ready for review. [Pri] Normal labels Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the fix/misc-react-19-stuff branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack fix/misc-react-19-stuff
bin/jetpack-downloader test jetpack-mu-wpcom-plugin fix/misc-react-19-stuff

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions Bot added [Feature] Publicize Now Jetpack Social, auto-sharing [JS Package] AI Client [JS Package] Charts [JS Package] Components [Package] Backup [Package] Publicize [Package] VideoPress [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests Admin Page React-powered dashboard under the Jetpack menu RNA labels Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@jp-launch-control

jp-launch-control Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/js-packages/charts/src/charts/line-chart/private/line-chart-annotation-label-popover.tsx 19/27 (70.37%) 1.14% 0 💚

Full summary · PHP report · JS report

tbradsha
tbradsha previously approved these changes Oct 8, 2026

@tbradsha tbradsha 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.

No blockers. As best I can tell things look fine. CI is happy on React 18.

await act( async () => {
await jest.advanceTimersByTimeAsync( ms );
} );
// Advance in small steps (~POLL_INTERVAL_MS). Longer steps never give React 19 a gap between updates, so it throws "Maximum update depth exceeded".

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.

Nitpick: we mention ~POLL_INTERVAL_MS here, but there are two different values for POLL_INTERVAL_MS in that package. I'd lean toward defining the constant here if we name it or else drop the reference.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hopefully people can figure out it's the one in the file this test corresponds to. 🤷

But now that I think of it, exporting the actual constant from that file shouldn't hurt anything. The one other caller also imports only the name it needs.

ebeda49

This branch has not been deployed

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

Labels

Admin Page React-powered dashboard under the Jetpack menu [Feature] Publicize Now Jetpack Social, auto-sharing [JS Package] AI Client [JS Package] Charts [JS Package] Components [Package] Backup [Package] Publicize [Package] VideoPress [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Pri] Normal RNA [Status] Needs Review This PR is ready for review. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants