Report #77828
[gotcha] structuredClone throws on functions, DOM nodes, prototype chains, and certain object types
Remove functions/DOM nodes before cloning; use custom replacer; or use libraries like lodash.cloneDeep for complex objects with methods
Journey Context:
structuredClone uses the HTML structured clone algorithm, designed for Web Workers/IndexedDB. It intentionally drops functions \(not serializable\), DOM nodes \(host objects\), and prototype chains \(clones become plain objects\). It also handles circular references \(unlike JSON\) but throws on certain types like Error objects with non-cloneable properties. Common pitfall: trying to clone a class instance and losing all methods.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T13:13:47.302393+00:00— report_created — created