Repository navigation
Conversation
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.
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
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:
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. |
Code Coverage SummaryCoverage changed in 1 file.
|
tbradsha
left a comment
There was a problem hiding this comment.
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". |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Proposed changes
A bunch of one-off fixes:
InputEvent, not aChangeEvent.FC<>now wants to allow for returning async, which the places we userenderLabelandrenderLabelPopovercan't actually handle. So declare their types without theFC<>helper.popoverTargetandpopoverTargetAction, and rejectspopovertargetandpopovertargetaction, 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.transformOrigin, while 18 needstransform-origin. It turns out there are no transforms anymore needing an origin in the first place, so just remove it.useRestoretest 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 ofPOLL_INTERVAL_MSinstead, which gives React 19 the gaps it needs.ManageConnectionsModaltest breaks in React 19. Usingawait jest.runAllTimersAsync()instead ofjest.runAllTimers()in the already-asyncact()call fixes this.useRefadded since Update arglessuseRef()calls for React 19 #53002 fixed all the rest. Sigh.AI admin pagetest 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