-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IndexedDB premium storage does not allow storing array properties #5046
Comments
Related: localForage/localForage#610 You can only store plain JSON data in RxDB. RxDB does not json-parse because the performance would decrease. |
I don't understand database.collections.contacts.insert({
id: 'abacdef'
name: 'Leandro',
emails: [
'[email protected]'
]
}) Following the reference Plain Objects the object above is a plain object. |
Can you make a PR with a test case? |
I found this test in the RxDB repository, and I believe that this test is not being executed using IndexedDB storage. |
I found the problem. |
* CHANGE eventReduce: true by default * FIX orga * v15 storage interface optimizations (#5002) * CHANGE bulkWrite return arrays instead of objects * FIX tests * IMPROVE performance * IMPROVE performance * OPTIMIZE performance of write row categorizing * IMPROVE memory write performance * FIX tests * CHANGE string regex (#5000) * CHANGE string regex * FIX lint * Feature/async hashing (#5013) * CHANGE async hash function * FIX tests * CHANGE hash attachments in rxdb instead of the RxStorage * FIX mongodb random test failures * TRIGGER push * CHANGE use webcrypto API for hashing * FIX test * FIX not dependend on specific hash function * TRY fix * FIX hashing in replication states * FIX types * FIX tests * FIX tests * FIX vue * RENAME replication-p2p to replication-webrtc * ADD docs page redirect * FIX random failures * CHANGE RxLocalDocument.$ must emit a document instance, not the plain data * FIX tests * TRY fix react native * ADD dev-mode check for dissalowed $ref #4926 (#5019) * RENAME send$ to sent$ (#5020) * UPDATE faker * ADD attachment replication (#5039) * ADD attachment replication * FIX tests * FIX tests * FIX typos * FIX tests * FIX tests * FIX ensure meta instance does not contain attachments data * ADD context to debug * FIX types * FIX randomly failing test * ADD(docs) attachment replication * ADD .info call (#5045) * ADD .info call * FIX types * REFACTOR data migrator (#5025) * REFACTOR data migrator * FIX maxLength * ADD stuff * CHORE migration * CHORE migration * CHORE migration * CHORE migration * REMOVE old * FIX close broadcast channel * FIX flutter * FIX closing of storages * CHORE migration * FIX tests * FIX types * FIX test * ADD log * FIX * ADD log * ADD log * FIX mongo * FIX * FIX spelling * FIX docs * FIX * REFACTOR bulkUpsert (#5057) * REFACTOR bulkUpsert * FIX docs * FIX docs * FIX version * REMOVE obsolete setter code from RxDocument * IMPROVE property access performance (#5063) * IMPROVE property access performance * FIX #4949 RxDocument.get() on additonalProperty * IMPROVE performance * IMPROVE performance * FIX bun * FIX image * ADD helpfull error message for #5046 (#5068) * FIX types * clear cache * FIX types * FIX npm ignore * REMOVE is-blob * CHORE type module (#5074) * CHORE type module * CHORE * CHORE * FIX build * FIX * cHORE * FIX typecheck * CHORE * CHORE * FIX typing tests * CHORE * CHORE * CHORE * CHORE * CHORE * ADD stuff * FIX typings test * FIX lint * REMOVE deps * ADD deno test * FIX * FIX * FIX imports * FIX test * FIX test * FIX browser tests * FIX loki test * FIX testes * FIX root import * FIX newline * FIX karma test * FIX lint * FIX * FIX build * FIX perf tests * FIX test * FIX stuff * FIX deno tests * FIX require * FIX loki * FIX * FIX deno * FIX landingpage build * ADD side effects false * FIX deno * FIX async storage init * FIX init * FIX deno tests * FIX deno tests * FIX empty tests * ADD deno performance tests * FIX types * FIX test * FIX * FIX tests * FIX tests * FIX ci * FIX ci order * FIX test * FIX init * FIX lint * FIX deno tests * REMOVE browserify output * REMOVE browserify index * FIX missing dep * FIX bigint not defined * FIX flutter
Hi @pubkey. The currently we're using a quick workaround in the codebase. however this does not seem ideal. Hope to have a proper fix from the plugin itself. if (process.env.NODE_ENV !== 'production') {
if (!global.structuredClone) {
global.structuredClone = function structuredClone(objectToClone: any) {
const stringified = JSON.stringify(objectToClone);
const parsed = JSON.parse(stringified);
return parsed;
};
}
} Further read:
|
Using
getRxStorageIndexedDB
when the schema has array properties on insert/update a document the error bellow is raised:indexeddb-storage-instance.js:1 Uncaught (in promise) DOMException: Failed to execute 'put' on 'IDBObjectStore': [object Array] could not be cloned. at l.bulkWrite (webpack-internal:///./node_modules/rxdb-premium/dist/es/plugins/storage-indexeddb/indexeddb-storage-instance.js:19:1349) at async RxCollectionBase.bulkInsert (webpack-internal:///./node_modules/rxdb/dist/es/rx-collection.js:180:19) at async RxCollectionBase.insert (webpack-internal:///./node_modules/rxdb/dist/es/rx-collection.js:145:23) at async onSaveClick (webpack-internal:///./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js??clonedRuleSet-41.use[1]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/PageForm.vue?vue&type=script&setup=true&lang=ts:46:11)
Using
getRxStorageDexie()
works fineExample repo:
https://github.com/leandrogehlen/ionic-vue-rxdb/tree/storage-indexeddb
The text was updated successfully, but these errors were encountered: