-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add explicit error handling for ResizeObserver errors
- Loading branch information
1 parent
d0d2eda
commit ddee475
Showing
2 changed files
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters