Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MBS-13716: Upgrade React to v19 RC #3345

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ branch_filters: &job_filters
executors:
musicbrainz-tests:
docker:
- image: metabrainz/musicbrainz-tests:v-2024-05-23
- image: metabrainz/musicbrainz-tests:v-2024-08-04
user: root
working_directory: /home/musicbrainz/musicbrainz-server

Expand Down
4 changes: 3 additions & 1 deletion docker/musicbrainz-tests/artwork-indexer.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

cd /home/musicbrainz/artwork-indexer

exec sudo -E -H -u musicbrainz bash -c '. venv/bin/activate; exec python3 indexer.py --max-wait=1'
export HOME=/home/musicbrainz
exec chpst -u musicbrainz:musicbrainz \
bash -c '. venv/bin/activate; exec python3 indexer.py --max-wait=1' 2>&1
1 change: 1 addition & 0 deletions docker/musicbrainz-tests/artwork-redirect-config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ port=5432
[listen]
address=localhost
port=8081
processes=2

[ia]
download_prefix=//localhost:5050/
Expand Down
5 changes: 4 additions & 1 deletion docker/musicbrainz-tests/artwork-redirect.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@

cd /home/musicbrainz/artwork-redirect

exec sudo -E -H -u musicbrainz bash -c '. venv/bin/activate; exec python3 artwork_redirect_server.py'
export HOME=/home/musicbrainz
exec chpst -u musicbrainz:musicbrainz \
bash -c '. venv/bin/activate; exec python3 artwork_redirect_server.py' \
2>&1
5 changes: 3 additions & 2 deletions docker/musicbrainz-tests/chrome.service
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/usr/bin/env bash

exec sudo -E -H -u musicbrainz /opt/chrome-linux64/chrome \
export HOME=/home/musicbrainz
exec chpst -u musicbrainz:musicbrainz /opt/chrome-linux64/chrome \
--headless \
--disable-dev-shm-usage \
--disable-gpu \
--no-sandbox \
--remote-debugging-port=9222 \
'about:blank'
'about:blank' 2>&1
2 changes: 1 addition & 1 deletion docker/musicbrainz-tests/postgresql.service
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh

exec chpst -u postgres:postgres \
/usr/lib/postgresql/16/bin/postgres -D /var/lib/postgresql/data
/usr/lib/postgresql/16/bin/postgres -D /var/lib/postgresql/data 2>&1
2 changes: 1 addition & 1 deletion docker/musicbrainz-tests/redis.service
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

exec redis-server
exec redis-server 2>&1
5 changes: 3 additions & 2 deletions docker/musicbrainz-tests/solr.service
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh

exec sudo -u solr /opt/solr/bin/solr start \
export HOME=/var/solr
exec chpst -u solr:solr /opt/solr/bin/solr start \
-f \
-Dsolr.autoSoftCommit.maxDocs=10 \
-Dsolr.autoSoftCommit.maxTime=1000
-Dsolr.autoSoftCommit.maxTime=1000 2>&1
4 changes: 3 additions & 1 deletion docker/musicbrainz-tests/ssssss.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ export SSSSSS_STORAGE=/var/ssssss
mkdir -p "$SSSSSS_STORAGE"
chown musicbrainz:musicbrainz "$SSSSSS_STORAGE"

exec sudo -E -H -u musicbrainz carton exec -- plackup --port 5050 -r contrib/ssssss.psgi
export HOME=/home/musicbrainz
exec chpst -u musicbrainz:musicbrainz \
carton exec -- plackup --port 5050 -r contrib/ssssss.psgi 2>&1
2 changes: 1 addition & 1 deletion docker/musicbrainz-tests/template-renderer.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

export RENDERER_WORKERS=2

exec /usr/local/bin/start_template_renderer.sh
exec /usr/local/bin/start_template_renderer.sh 2>&1
3 changes: 2 additions & 1 deletion docker/musicbrainz-tests/vnu.service
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh

exec java -cp /home/musicbrainz/vnu/vnu.jar nu.validator.servlet.Main 8888
exec java -cp /home/musicbrainz/vnu/vnu.jar \
nu.validator.servlet.Main 8888 2>&1
4 changes: 3 additions & 1 deletion docker/scripts/start_template_renderer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ then
sudo -E -H -u musicbrainz carton exec -- ./script/compile_resources.sh server
fi

exec sudo -E -H -u musicbrainz carton exec -- ./script/start_renderer.pl
export HOME="$MBS_HOME"
exec chpst -u musicbrainz:musicbrainz \
carton exec -- ./script/start_renderer.pl
6 changes: 3 additions & 3 deletions docker/templates/Dockerfile.tests.m4
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,19 @@ RUN sudo -E -H -u musicbrainz git clone https://github.com/metabrainz/artwork-in
sudo -E -H -u musicbrainz sh -c 'python3.11 -m venv venv; . venv/bin/activate; pip install -r requirements.txt' && \
cd /home/musicbrainz

ENV ARTWORK_REDIRECT_COMMIT 9863559
ENV ARTWORK_REDIRECT_COMMIT 1ab748a

RUN sudo -E -H -u musicbrainz git clone https://github.com/metabrainz/artwork-redirect.git && \
cd artwork-redirect && \
sudo -E -H -u musicbrainz git reset --hard $ARTWORK_REDIRECT_COMMIT && \
sudo -E -H -u musicbrainz sh -c 'python3.11 -m venv venv; . venv/bin/activate; pip install -r requirements.txt' && \
cd /home/musicbrainz

RUN curl -sSLO https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/119.0.6045.105/linux64/chrome-linux64.zip && \
RUN curl -sSLO https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/127.0.6533.119/linux64/chrome-linux64.zip && \
unzip chrome-linux64.zip -d /opt && \
rm chrome-linux64.zip

RUN curl -sSLO https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/119.0.6045.105/linux64/chromedriver-linux64.zip && \
RUN curl -sSLO https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/127.0.6533.119/linux64/chromedriver-linux64.zip && \
unzip chromedriver-linux64.zip -d /tmp && \
mv /tmp/chromedriver-linux64/chromedriver /usr/local/bin/ && \
chmod +x /usr/local/bin/chromedriver && \
Expand Down
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
4 changes: 4 additions & 0 deletions root/static/scripts/edit/components/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ MB.installFormUnloadWarning = function () {
return false;
}

if (MUSICBRAINZ_RUNNING_TESTS) {
sessionStorage.setItem('didShowBeforeUnloadAlert', 'true');
}

event.returnValue = l(
'All of your changes will be lost if you leave this page.',
);
Expand Down
3 changes: 3 additions & 0 deletions root/static/scripts/release-editor/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ releaseEditor.init = function (options) {

window.addEventListener('beforeunload', event => {
if (hasEdits() && !this.rootField.redirecting) {
if (MUSICBRAINZ_RUNNING_TESTS) {
sessionStorage.setItem('didShowBeforeUnloadAlert', 'true');
}
event.returnValue = l(
'All of your changes will be lost if you leave this page.',
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1744,6 +1744,9 @@ component _ReleaseRelationshipEditor() {
return undefined;
}
if (hasPendingEdits) {
if (MUSICBRAINZ_RUNNING_TESTS) {
sessionStorage.setItem('didShowBeforeUnloadAlert', 'true');
}
// Modern browsers don't actually display this string for security.
event.returnValue =
'All of your changes will be lost if you leave this page.';
Expand Down
Loading