vue-composable icon indicating copy to clipboard operation
vue-composable copied to clipboard

RefShared DOMException error if data contains array

Open johnrossporter opened this issue 1 year ago • 0 comments

When using refShared and modifying data, I am getting the following error in browser console:

Uncaught (in promise) DOMException: Failed to execute 'postMessage' on 'BroadcastChannel': [object Array] could not be cloned. at send (http://127.0.0.1:5173/node_modules/.vite/deps/vue-composable.js?v=feda6e83:1262:22) at watch.deep (http://127.0.0.1:5173/node_modules/.vite/deps/vue-composable.js?v=feda6e83:1821:5) at callWithErrorHandling (http://127.0.0.1:5173/node_modules/.vite/deps/chunk-BX7HPCYS.js?v=86b71d6a:1373:18) at callWithAsyncErrorHandling (http://127.0.0.1:5173/node_modules/.vite/deps/chunk-BX7HPCYS.js?v=86b71d6a:1381:17) at job (http://127.0.0.1:5173/node_modules/.vite/deps/chunk-BX7HPCYS.js?v=86b71d6a:2643:9) at callWithErrorHandling (http://127.0.0.1:5173/node_modules/.vite/deps/chunk-BX7HPCYS.js?v=86b71d6a:1373:32) at flushJobs (http://127.0.0.1:5173/node_modules/.vite/deps/chunk-BX7HPCYS.js?v=86b71d6a:1560:9)

This error usually happens when data contains non-serializable elements such as functions, but I think my data should be okay.

const shared = refShared({arr:[1,2,3]}, "test"); return { shared }

The exception happens when I modify it as such this.shared.arr = [4,5,6]

Note that this error only seems to occur with my array. If I have a string or a number it works fine.

johnrossporter avatar Oct 14 '22 17:10 johnrossporter