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

[core] Fix react next patch and prevent regression #21482

Merged
merged 1 commit into from Jun 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 9 additions & 13 deletions scripts/react-next.diff
@@ -1,8 +1,8 @@
diff --git a/packages/material-ui-lab/src/Autocomplete/Autocomplete.test.js b/packages/material-ui-lab/src/Autocomplete/Autocomplete.test.js
index 5e83281c0..3c995f97c 100644
index 2f3ea31dc..4ad337e85 100644
--- a/packages/material-ui-lab/src/Autocomplete/Autocomplete.test.js
+++ b/packages/material-ui-lab/src/Autocomplete/Autocomplete.test.js
@@ -963,7 +963,7 @@ describe('<Autocomplete />', () => {
@@ -1018,7 +1018,7 @@ describe('<Autocomplete />', () => {
fireEvent.keyDown(textbox, { key: 'Enter' });
expect(handleChange.callCount).to.equal(1);
expect(handleChange.args[0][1]).to.equal('a');
Expand All @@ -11,7 +11,7 @@ index 5e83281c0..3c995f97c 100644
expect(consoleErrorMock.messages()[0]).to.include(
'Material-UI: The `getOptionLabel` method of Autocomplete returned undefined instead of a string',
);
@@ -993,7 +993,7 @@ describe('<Autocomplete />', () => {
@@ -1070,7 +1070,7 @@ describe('<Autocomplete />', () => {
/>,
);

Expand All @@ -20,7 +20,7 @@ index 5e83281c0..3c995f97c 100644
expect(consoleWarnMock.messages()[0]).to.include(
'None of the options match with `"not a good value"`',
);
@@ -1022,7 +1022,7 @@ describe('<Autocomplete />', () => {
@@ -1099,7 +1099,7 @@ describe('<Autocomplete />', () => {
const options = getAllByRole('option').map((el) => el.textContent);
expect(options).to.have.length(7);
expect(options).to.deep.equal(['A', 'D', 'E', 'B', 'G', 'F', 'C']);
Expand All @@ -30,7 +30,7 @@ index 5e83281c0..3c995f97c 100644
});
});
diff --git a/packages/material-ui-styles/src/ThemeProvider/ThemeProvider.test.js b/packages/material-ui-styles/src/ThemeProvider/ThemeProvider.test.js
index 5c9d0be26..7f0862466 100644
index 9013d9095..7f0862466 100644
--- a/packages/material-ui-styles/src/ThemeProvider/ThemeProvider.test.js
+++ b/packages/material-ui-styles/src/ThemeProvider/ThemeProvider.test.js
@@ -135,7 +135,7 @@ describe('ThemeProvider', () => {
Expand Down Expand Up @@ -65,7 +65,7 @@ index ed0e37f21..49d8ea9b0 100644
'Material-UI: You have provided an invalid combination of props to the Breadcrumbs.\nitemsAfterCollapse={2} + itemsBeforeCollapse={2} >= maxItems={3}',
);
diff --git a/packages/material-ui/src/TextareaAutosize/TextareaAutosize.test.js b/packages/material-ui/src/TextareaAutosize/TextareaAutosize.test.js
index cea126a0d..1eaf80628 100644
index 09daadd96..1eaf80628 100644
--- a/packages/material-ui/src/TextareaAutosize/TextareaAutosize.test.js
+++ b/packages/material-ui/src/TextareaAutosize/TextareaAutosize.test.js
@@ -261,7 +261,7 @@ describe('<TextareaAutosize />', () => {
Expand Down Expand Up @@ -100,19 +100,15 @@ index 41a38bc07..c9397fd13 100644
expect(consoleErrorMock.messages()[1]).to.include(
'Material-UI: A component is changing the controlled checked state of SwitchBase to be uncontrolled.',
diff --git a/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js b/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js
index 68b0a4a5c..e31152c44 100644
index ba9977d1a..b5ca0ca4b 100644
--- a/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js
+++ b/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js
@@ -284,14 +284,10 @@ describe('useMediaQuery', () => {
}
@@ -285,7 +285,7 @@ describe('useMediaQuery', () => {

render(<MyComponent />);
- // logs warning twice in StrictMode
// logs warning twice in StrictMode
- expect(consoleErrorMock.callCount()).to.equal(2); // strict mode renders twice
+ expect(consoleErrorMock.callCount()).to.equal(1);
expect(consoleErrorMock.messages()[0]).to.include(
'Material-UI: The `query` argument provided is invalid',
);
});
});
});
9 changes: 1 addition & 8 deletions scripts/use-react-dist-tag.js
Expand Up @@ -51,14 +51,7 @@ async function main(distTag) {
// add newline for clean diff
fs.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}${os.EOL}`);

try {
await exec(`git apply ${path.resolve(__dirname, `./react-${distTag}.diff`)}`);
} catch (error) {
// ignore if the patch doesn't exist
if (error.code !== 128) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This code is not necessarily tied to non-existing patches. It hid the error message that the patch was corrupted.

I don't remember why I added it. In the end we could always leave the patch empty on certain branches.

throw error;
}
}
await exec(`git apply ${path.resolve(__dirname, `./react-${distTag}.diff`)}`);
}

main(process.env.REACT_DIST_TAG).catch((error) => {
Expand Down