Skip to content

fix: correct panelSumary typo to panelSummary in Error componentFix/error panel summary typo #10652

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

Closed
Closed
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
26 changes: 26 additions & 0 deletions cypress/e2e/support/resize-observer-mock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Mock ResizeObserver to prevent "ResizeObserver loop completed with undelivered notifications" errors
class ResizeObserverMock {
constructor(callback) {
this.callback = callback;
this.observations = new Map();
}

observe(element) {
this.observations.set(element, {});
// Trigger initial callback
this.callback([{ target: element }], this);
}

unobserve(element) {
this.observations.delete(element);
}

disconnect() {
this.observations.clear();
}
}

// Replace the global ResizeObserver with our mock
if (window.ResizeObserver) {
window.ResizeObserver = ResizeObserverMock;
}
32 changes: 20 additions & 12 deletions cypress/support/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import 'cypress-plugin-tab';
import '../e2e/support/resize-observer-mock';

/*
* This is a workaround for the ResizeObserver loop error that occurs in Cypress.
* See https://github.com/cypress-io/cypress/issues/20341
* See https://github.com/cypress-io/cypress/issues/29277
*/
Cypress.on('uncaught:exception', err => {
if (
err.message.includes(
'ResizeObserver loop completed with undelivered notifications'
)
) {
return false;
// Make the CI fail if console.error in tests
const originalConsoleError = console.error;
console.error = (...args) => {
originalConsoleError.call(console, args);
throw new Error(
JSON.stringify({
message: 'The tests failed due to `console.error` calls',
error: args,
})
);
};

// Ignore warnings about act()
// See https://github.com/testing-library/react-testing-library/issues/281,
// https://github.com/facebook/react/issues/14769
jest.spyOn(console, 'error').mockImplementation((...args) => {
if (/Warning.*not wrapped in act/.test(args[0])) {
return;
}
originalConsoleError.call(console, ...args);
});
6 changes: 3 additions & 3 deletions packages/ra-ui-materialui/src/layout/Error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const Error = (
<Accordion className={ErrorClasses.panel}>
<AccordionSummary
expandIcon={<ExpandMoreIcon />}
className={ErrorClasses.panelSumary}
className={ErrorClasses.panelSummary}
>
{translate(error.message, {
_: error.message,
Expand Down Expand Up @@ -146,7 +146,7 @@ export const ErrorClasses = {
title: `${PREFIX}-title`,
icon: `${PREFIX}-icon`,
panel: `${PREFIX}-panel`,
panelSumary: `${PREFIX}-panelSumary`,
panelSummary: `${PREFIX}-panelSummary`,
panelDetails: `${PREFIX}-panelDetails`,
toolbar: `${PREFIX}-toolbar`,
advice: `${PREFIX}-advice`,
Expand Down Expand Up @@ -182,7 +182,7 @@ const Root = styled('div', {
maxWidth: '60em',
},

[`& .${ErrorClasses.panelSumary}`]: {
[`& .${ErrorClasses.panelSummary}`]: {
userSelect: 'all',
},

Expand Down