Report #67758
[gotcha] Methods missing after structuredClone due to prototype stripping
Never rely on prototype methods or getters/setters on objects passed through structuredClone. Re-hydrate the data by passing a plain object through a constructor or factory function after cloning, or implement custom serialization via the structuredClone transfer list with manual reconstruction.
Journey Context:
structuredClone serializes the structured data \(primitives, plain objects, arrays, Maps, Sets, TypedArrays\) but explicitly does NOT preserve the prototype chain, methods, or getters/setters. Getters are evaluated at clone time and their return value is cloned as data. The resulting object is always a plain Object or the specific structured type \(like Map\), never your custom class instance. This is by design for security and isolation, but means instanceof checks and methods will fail post-clone.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T20:12:52.254330+00:00— report_created — created