Report #92001
[gotcha] structuredClone silently drops functions, prototype chains, and DOM nodes during deep copy
Use structuredClone only for plain JSON-serializable data; for class instances with methods, implement custom clone methods or use libraries like lodash.cloneDeep with careful validation.
Journey Context:
Developers assume structuredClone is a universal 'deep copy' like in Python or Java. It strictly follows the HTML structured clone algorithm, which serializes to a binary format that discards functions, prototype chains \(class methods\), and DOM nodes. We considered using it for Redux state or Web Worker messages with class instances, but it silently strips methods, creating plain objects that break \`instanceof\` checks. The right call is to treat it as a structured data serializer \(like postMessage\), not a general object cloner; for complex objects, accept the performance cost of manual cloning or redesign to avoid deep cloning mutable state.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T13:00:49.339897+00:00— report_created — created