Dexie.js
Dexie.js copied to clipboard
Way to solve DexieDataClone Error
What exactly is https://dexie.org/docs/DexieErrors/Dexie.DataCloneError and How to prevent /fix it
It broke my whole codebase
It means you tried to store an object that contained properties of unsupported (not clonable) types. The supported types are defined in the DOM standard structured cloning.
Examples of supported types: string, number, Blob, typed arrays, Map, Set, CryptoKey, arrays, booleans, null etc. Examples of unsupported types: function, symbol, WebSocket, WeakMap, window, document, etc ...
To "fix it", you first need to debug your code and look at the data you are trying to put into IndexedDB. Does it contain the data you intend it to contain? Or do you have an application bug that makes it try to store a function or something else that isn't clonable?
It means you tried to store an object that contained properties of unsupported (not clonable) types. The supported types are defined in the DOM standard structured cloning.
Examples of supported types: string, number, Blob, typed arrays, Map, Set, CryptoKey, arrays, booleans, null etc. Examples of unsupported types: function, symbol, WebSocket, WeakMap, window, document, etc ...
To "fix it", you first need to debug your code and look at the data you are trying to put into IndexedDB. Does it contain the data you intend it to contain? Or do you have an application bug that makes it try to store a function or something else that isn't clonable?
Thanks I'll Check it
Is there any library or a good way to check the members of object is clonable or not by structured cloning algorithm ?
Is there any library or a good way to check the members of object is clonable or not by structured cloning algorithm ?
Maybe typeson with preset structuredCloningThrowing from typeson-registry. To test against the real DOM you could also start a Worker and do postMessage() to it with your object.