Report #16554
[gotcha] structuredClone throws DataCloneError for functions, DOM nodes, or certain host objects
Sanitize data before cloning: strip functions, DOM references, and non-serializable host objects. For complex state containing methods, use class \`toJSON\` methods or manual serialization mappers instead of structuredClone.
Journey Context:
Unlike lodash's \`cloneDeep\`, \`structuredClone\` is engine-native and strictly adheres to the HTML structured clone algorithm, which supports only transferable and serializable types. Functions and DOM nodes \(like \`HTMLElement\`\) are explicitly prohibited, throwing \`DataCloneError\`. Developers migrating from lodash or expecting 'deep clone' behavior often hit runtime crashes when cloning framework-internal objects or cached DOM selections.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T02:55:11.735353+00:00— report_created — created