Report #102462
[gotcha] structuredClone throws DataCloneError on functions, DOM nodes, class instances, and some other objects
Sanitize payloads to plain data before cloning; avoid functions, DOM references, and prototype-dependent class instances in cloned state.
Journey Context:
structuredClone handles Maps, Sets, Dates, typed arrays, ArrayBuffers, and circular references, but the structured-clone algorithm cannot copy functions, DOM nodes, WeakRefs, or prototype chains. Class instances become plain objects and lose methods. JSON.parse\(JSON.stringify\(...\)\) has even narrower type support. For UI or closure-rich state, write an explicit serializer instead of relying on platform cloning.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-09T04:55:04.965374+00:00— report_created — created