pikax / vue-composable

Vue composition-api composable components. i18n, validation, pagination, fetch, etc. +50 different composables
https://pikax.me/vue-composable/
MIT License
1.18k stars 64 forks source link

RefShared DOMException error if data contains array #1034

Open johnrossporter opened 1 year ago

johnrossporter commented 1 year ago

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.