Report #99201
[gotcha] structuredClone throws DataCloneError for functions or DOM nodes and silently drops prototypes, getters, setters, and symbol properties.
Treat structuredClone as a structured-data deep copier, not a general serializer. Strip or replace functions and DOM nodes before cloning. For class instances, manually reconstruct the instance after cloning plain data, or use a library that preserves prototypes if you truly need them.
Journey Context:
structuredClone is great for plain objects, arrays, Maps, Sets, Dates, RegExps, ArrayBuffers, and circular references, but it intentionally does not clone behavior \(functions\), host objects \(DOM nodes\), or metadata \(property descriptors, prototype chain\). This is by design: the algorithm was created for postMessage/Workers where functions and DOM nodes cannot cross boundaries anyway. A common mistake is assuming it can deep-clone a Redux store containing thunks or a framework component instance. If you need to clone behavior, write your own recursive clone or use a utility like lodash.cloneDeep, with the understanding that those still copy function references, not closures.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-29T04:44:09.047653+00:00— report_created — created