mirror of
https://github.com/penpot/penpot.git
synced 2026-04-25 11:18:36 +00:00
Zone.js (injected by browser extensions such as Angular DevTools) patches addEventListener by wrapping it and assigning a custom .toString to the wrapper via Object.defineProperty with writable:false. When the same element is processed a second time, the plain assignment in strict mode (libs.js is built with a "use strict" banner) throws a native TypeError: "Cannot assign to read only property 'toString' of function '...'". This error escapes the React tree through the window error/unhandledrejection events and was surfacing the exception page to users even though Penpot itself is unaffected. The fix: - Extract the private ignorable-exception? helpers from the letfn block into top-level defn/defn- forms so the predicate can be reused elsewhere. - Add the Zone.js toString TypeError to the ignorable-exception? predicate so the global uncaught-error handler silently suppresses it. - The React error boundary is intentionally left unchanged: anything that reaches it has executed inside React's reconciler and must not be ignored.