mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-15 03:12:36 +03:00
initTinyCmsWasm()/generateSecurePayload() installed global.window/document DOM shims via setupDomMocks() but never called the returned restore callback. On an npm-global install the Next.js dashboard SSR runs in the same Node process, so after the first TinyCMS request every later SSR render observed the leaked fake document, whose createElement() returns null for anything but 'canvas' — turning the next render into a 500. Wrap both call sites in install -> use -> restore (try/finally) so the shims are scoped to just the call instead of the process lifetime. Also fixes a second, smaller bug found while tracing the client-visible symptom: fetchInterceptionToggles() called res.json() without checking res.ok first, so a non-JSON error body (e.g. the plain-text 500 above) surfaced as a raw SyntaxError in the interceptionLoadError toast instead of a clean HTTP <status> message.