Skip to content

Commit

Permalink
Add explicit error handling for ResizeObserver errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathonherbert committed Mar 4, 2024
1 parent a458c5f commit bde7069
Show file tree
Hide file tree
Showing 4 changed files with 235 additions and 435 deletions.
15 changes: 15 additions & 0 deletions fronts-client/integration/fixtures/error-handling.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* These errors are sometimes thrown by the browser and appear to be beyond our control.
* They don't stop execution, so ignore them.
*/
export const explicitErrorHandler = () => {
window.addEventListener('error', (e) => {
if (
e.message ===
'ResizeObserver loop completed with undelivered notifications.' ||
e.message === 'ResizeObserver loop limit exceeded'
) {
e.stopImmediatePropagation();
}
});
};
2 changes: 2 additions & 0 deletions fronts-client/integration/tests/main.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ import {
} from '../selectors';
import setup from '../server/setup';
import teardown from '../server/teardown';
import { explicitErrorHandler } from '../fixtures/error-handling';

fixture`Fronts edit`.page`http://localhost:3456/v2/editorial`
.clientScripts({ content: `(${explicitErrorHandler.toString()})()` })
.before(setup)
.after(teardown);

Expand Down
2 changes: 1 addition & 1 deletion fronts-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"react-test-renderer": "^16.13.0",
"redux-mock-store": "^1.5.3",
"style-loader": "^0.23.1",
"testcafe": "^1.1.4",
"testcafe": "^3.5.0",
"ts-jest": "^29.1.0",
"ts-loader": "^6.1.0",
"tslint": "^5.11.0",
Expand Down
Loading

0 comments on commit bde7069

Please sign in to comment.