Report #67985
[gotcha] structuredClone silently strips methods, getters, and prototype chain from objects
Use structuredClone only for plain data \(POJOs, Arrays, Maps, Sets\). To clone objects with methods or custom prototypes, implement a custom cloning function or serialization/deserialization pattern.
Journey Context:
Developers assume structuredClone is a 'deep clone' panacea. It invokes getters and serializes the result, discarding the getter itself. Functions and methods are dropped \(silently for functions in data properties, throws for non-serializable types like DOM nodes\). The prototype is reset to Object.prototype. This breaks class instances and any object with behavior.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T20:35:29.935858+00:00— report_created — created