Skip to content

Commit

Permalink
MBS-13716: Upgrade React to v19 RC
Browse files Browse the repository at this point in the history
https://react.dev/blog/2024/04/25/react-19
https://react.dev/blog/2024/04/25/react-19-upgrade-guide

It seems that a new version of the react-dom libdefs have not been published to
flow-typed yet. I simply moved the existing v18 file and removed all removed
functions. I didn't add any of the new functions (we don't use them yet).

A strange failure occurred in External_Links_Editor.json5: when typing
"https://www.discogs.com/David-Bowie--Blackstar/release/7949394", it somehow
omits the "s" in "release", which causes a validation error. I have no idea how
the React upgrade could have caused this, and I can't reproduce it outside of
the tests (e.g., by pasting the same URL manually, or by typing it slowly). The
only way around this I could find was avoiding `sendKeys` in the `type`
command, so I'm just using `setInputValueForReact` again (which is already used
for clearing the input).
  • Loading branch information
mwiencek committed Aug 21, 2024
1 parent 2d31ff8 commit f5c4131
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 125 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// flow-typed signature: bd8a9984746306d26194a489f3aeff35
// flow-typed version: 388e9edcf0/react-dom_v18.x.x/flow_>=v0.127.x
// @flow strict

declare module 'react-dom_shared-types' {
/**
Expand Down Expand Up @@ -107,29 +106,11 @@ declare module 'react-dom_shared-types' {
declare module 'react-dom' {
declare var version: string;

declare function findDOMNode(
componentOrElement: Element | ?React$Component<any, any>
): null | Element | Text;

declare function render<ElementType: React.ElementType>(
element: React.Element<ElementType>,
container: Element,
callback?: () => void
): React.ElementRef<ElementType>;

declare function hydrate<ElementType: React.ElementType>(
element: React.Element<ElementType>,
container: Element,
callback?: () => void
): React.ElementRef<ElementType>;

declare function createPortal(
node: React.Node,
container: Element
): React$Portal;

declare function unmountComponentAtNode(container: any): boolean;

declare function flushSync(callback: () => mixed): void;

declare function unstable_batchedUpdates<A, B, C, D, E>(
Expand Down Expand Up @@ -214,81 +195,3 @@ declare module 'react-dom/server' {
element: React.Node
): stream$Readable;
}

declare module 'react-dom/test-utils' {
declare interface Thenable {
then(resolve: () => mixed, reject?: () => mixed): mixed,
}

declare var Simulate: {
[eventName: string]: (
element: Element,
eventData?: { [key: string]: mixed, ... }
) => void,
...
};

declare function renderIntoDocument(
instance: React.Element<any>
): React$Component<any, any>;

declare function mockComponent(
componentClass: React.ElementType,
mockTagName?: string
): { [key: string]: mixed, ... };

declare function isElement(element: React.Element<any>): boolean;

declare function isElementOfType(
element: React.Element<any>,
componentClass: React.ElementType
): boolean;

declare function isDOMComponent(instance: any): boolean;

declare function isCompositeComponent(
instance: React$Component<any, any>
): boolean;

declare function isCompositeComponentWithType(
instance: React$Component<any, any>,
componentClass: React.ElementType
): boolean;

declare function findAllInRenderedTree(
tree: React$Component<any, any>,
test: (child: React$Component<any, any>) => boolean
): Array<React$Component<any, any>>;

declare function scryRenderedDOMComponentsWithClass(
tree: React$Component<any, any>,
className: string
): Array<Element>;

declare function findRenderedDOMComponentWithClass(
tree: React$Component<any, any>,
className: string
): ?Element;

declare function scryRenderedDOMComponentsWithTag(
tree: React$Component<any, any>,
tagName: string
): Array<Element>;

declare function findRenderedDOMComponentWithTag(
tree: React$Component<any, any>,
tagName: string
): ?Element;

declare function scryRenderedComponentsWithType(
tree: React$Component<any, any>,
componentClass: React.ElementType
): Array<React$Component<any, any>>;

declare function findRenderedComponentWithType(
tree: React$Component<any, any>,
componentClass: React.ElementType
): ?React$Component<any, any>;

declare function act(callback: () => void | Thenable): Thenable;
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
"pg-cursor": "2.10.5",
"po2json": "https://github.com/metabrainz/po2json.git#905dd32b286c80b973ca3c7c27f31d0ef1f4e65b",
"punycode": "2.3.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"react": "19.0.0-rc-1d989965-20240821",
"react-dom": "19.0.0-rc-1d989965-20240821",
"react-table": "7.8.0",
"redux": "4.2.0",
"shell-quote": "1.8.1",
Expand Down
6 changes: 5 additions & 1 deletion t/selenium.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,11 @@ async function handleCommand({command, target, value}, t, ...args) {
'window.MB.setInputValueForReact(arguments[0], "")',
element,
);
await element.sendKeys(value);
await driver.executeScript(
'window.MB.setInputValueForReact(arguments[0], ' +
`${JSON.stringify(value)})`,
element,
);
break;

case 'uncheck':
Expand Down
14 changes: 12 additions & 2 deletions t/selenium/External_Links_Editor.json5
Original file line number Diff line number Diff line change
Expand Up @@ -508,15 +508,25 @@
target: '1500',
value: '',
},
{
command: 'type',
target: "xpath=(//table[@id='external-links-editor']//input[@type='url'])[1]",
value: 'https://www.discogs.com/David-Bowie--Blackstar/release/7949394',
},
{
command: 'sendKeys',
target: "xpath=(//table[@id='external-links-editor']//input[@type='url'])[1]",
value: 'https://www.discogs.com/David-Bowie--Blackstar/release/7949394${KEY_ENTER}',
value: '${KEY_ENTER}',
},
{
command: 'type',
target: "xpath=(//table[@id='external-links-editor']//input[@type='url'])[1]",
value: 'https://www.amazon.co.jp/Blackstar-David-Bowie/dp/B017VORJK6/',
},
{
command: 'sendKeys',
target: "xpath=(//table[@id='external-links-editor']//input[@type='url'])[1]",
value: 'https://www.amazon.co.jp/Blackstar-David-Bowie/dp/B017VORJK6/${KEY_ENTER}',
value: '${KEY_ENTER}',
},
{
command: 'assertElementPresent',
Expand Down
39 changes: 17 additions & 22 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5966,7 +5966,7 @@ __metadata:
languageName: node
linkType: hard

"loose-envify@npm:^1.1.0, loose-envify@npm:^1.4.0":
"loose-envify@npm:^1.4.0":
version: 1.4.0
resolution: "loose-envify@npm:1.4.0"
dependencies:
Expand Down Expand Up @@ -6352,8 +6352,8 @@ __metadata:
po2json: "https://github.com/metabrainz/po2json.git#905dd32b286c80b973ca3c7c27f31d0ef1f4e65b"
process: "npm:0.11.10"
punycode: "npm:2.3.1"
react: "npm:18.3.1"
react-dom: "npm:18.3.1"
react: "npm:19.0.0-rc-1d989965-20240821"
react-dom: "npm:19.0.0-rc-1d989965-20240821"
react-is: "npm:18.3.1"
react-table: "npm:7.8.0"
redux: "npm:4.2.0"
Expand Down Expand Up @@ -7262,15 +7262,14 @@ __metadata:
languageName: node
linkType: hard

"react-dom@npm:18.3.1":
version: 18.3.1
resolution: "react-dom@npm:18.3.1"
"react-dom@npm:19.0.0-rc-1d989965-20240821":
version: 19.0.0-rc-1d989965-20240821
resolution: "react-dom@npm:19.0.0-rc-1d989965-20240821"
dependencies:
loose-envify: "npm:^1.1.0"
scheduler: "npm:^0.23.2"
scheduler: "npm:0.25.0-rc-1d989965-20240821"
peerDependencies:
react: ^18.3.1
checksum: 10c0/a752496c1941f958f2e8ac56239172296fcddce1365ce45222d04a1947e0cc5547df3e8447f855a81d6d39f008d7c32eab43db3712077f09e3f67c4874973e85
react: 19.0.0-rc-1d989965-20240821
checksum: 10c0/90d13dfae2642bded2f5ea8d29cb065529fe8805d5341f6b9e6f809c2c16e1d3322ef7a2a78c04ca2ed061dc7e7fdda4799e0d586b463b5ce41a9ad57ce419e4
languageName: node
linkType: hard

Expand All @@ -7297,12 +7296,10 @@ __metadata:
languageName: node
linkType: hard

"react@npm:18.3.1":
version: 18.3.1
resolution: "react@npm:18.3.1"
dependencies:
loose-envify: "npm:^1.1.0"
checksum: 10c0/283e8c5efcf37802c9d1ce767f302dd569dd97a70d9bb8c7be79a789b9902451e0d16334b05d73299b20f048cbc3c7d288bbbde10b701fa194e2089c237dbea3
"react@npm:19.0.0-rc-1d989965-20240821":
version: 19.0.0-rc-1d989965-20240821
resolution: "react@npm:19.0.0-rc-1d989965-20240821"
checksum: 10c0/b7ce06b6ed7d4bb3acb722dab7e91ef52601f28fb6fd5d46ba0946cbd3bb98c9b4baa2f33ad883eec409d3385777a8a528386fbc254313d61864db326f55af98
languageName: node
linkType: hard

Expand Down Expand Up @@ -7819,12 +7816,10 @@ __metadata:
languageName: node
linkType: hard

"scheduler@npm:^0.23.2":
version: 0.23.2
resolution: "scheduler@npm:0.23.2"
dependencies:
loose-envify: "npm:^1.1.0"
checksum: 10c0/26383305e249651d4c58e6705d5f8425f153211aef95f15161c151f7b8de885f24751b377e4a0b3dd42cce09aad3f87a61dab7636859c0d89b7daf1a1e2a5c78
"scheduler@npm:0.25.0-rc-1d989965-20240821":
version: 0.25.0-rc-1d989965-20240821
resolution: "scheduler@npm:0.25.0-rc-1d989965-20240821"
checksum: 10c0/a93a32ce651a61ddf33f5cdd945ac3df056a8fee9def99ad3fe7691416a9bef58c89028ee31003cf5a0feb4f0dd3536192c7015326c5cdd5568ab4bf88f25bc7
languageName: node
linkType: hard

Expand Down

0 comments on commit f5c4131

Please sign in to comment.