Skip to content

structuredClone api will produce an error if argument is reactive object #8975

Closed
@ishowman

Description

@ishowman

Vue version

all

Link to minimal reproduction

https://play.vuejs.org/#eNqtUstO3DAU/ZVbbzIjpY4GdtOA1FKktou2ait1gZGIkjvB4NiWHyEoyr9z42EGECNW7OzzsM99jOyztbyPyNas9LWTNoDHEO2p0LKzxgUYwWFVB9ljTqcNTLBxpoOMTJnQQtdG+wCdb+Fk5hfZN1TKwH/jVPMhW+4EUm/M6lEyCg0QZIdr+FoF5NrcLZb5DFbOVfdruFjlMM6ONSQt6GoWZ8Mw0J8A03Qp9PTi7aP09jboO39gFHJl2sVVg2jnSq9y8MHFOkSHzZkyGheE8r5SEZfLT0IXxWtfasABZ8KfeeGw9eiAdeScJ25KzrLYTpBmR5eAnVVUPN0AyuvV6TimKU1TWdAtoVLbGKD/2JkG1YlgxAtGVFns3SxnwVOkjWz5jTeaFiV1TLDadFYqdL9skBRZsF0viatoBe5+JIwyY2p98lxjfXsAv/HDjAn226FH16Ngey5UrsWwpc///sSBznuSkkdF6jfIP0jtjHPGrexL1A3FfqZLab+ndZe6/efPh4Da74qag6adSHrBaPHP3ij9Ke4xP04+2iQ2PQBkQyWE

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    has workaroundA workaround has been found to avoid the problemwontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions