`structuredClone` api will produce an error if argument is reactive object
Vue version
all
Link to minimal reproduction
Steps to reproduce
What is expected?
support data structure like Object in reactive variable.
What is actually happening?
Only basic data structure like string, number in reactive variable is supported by structuredClone
api.
Here are the example codes with errors:
const info1 = ref({
time: Date.now(),
array: [1, {info: {
name: 'xxx'
}}]
})
const info2 = reactive({
time: Date.now(),
array: [1, {info: {
name: 'xxx'
}}]
})
console.log(`deep info1`, structuredClone(info1.value));
console.log(`deep info2`, structuredClone(info2));
System Info
No response
Any additional comments?
No response
structuredClone
does not support Proxy. see https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types
use structuredClone(toRaw(xxx))
instead.