Report #71314
[gotcha] structuredClone silently drops functions and throws DataCloneError for DOM nodes
Check for functions or DOM nodes before cloning, strip them manually, or implement a custom replacer that handles these types explicitly.
Journey Context:
structuredClone is often used as a safer alternative to JSON.parse\(JSON.stringify\(\)\) for deep cloning, but it follows the Structured Clone Algorithm which explicitly forbids functions \(silently discarded\) and DOM nodes \(throws\). Developers migrating from lodash.cloneDeep or manual JSON serialization may not realize these limitations, leading to silently broken application state where functions disappear or uncaught exceptions in browser contexts.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T02:16:38.637578+00:00— report_created — created