Closed Yonier closed 3 years ago
I'm having the same issues trying to upgrade from vue 2 to vue 3 while using LocalForage + Vuex-ORM. My guess is it has something to do with the new use of Proxy objects in Vue 3.
Edit: Guess was correct, if I had checked out your screenshot I wouldn't have had to guess
I was able to get around this by using the clone method from pouchDB to clean up my state from any proxy objects.
import {clone} from 'pouchdb-utils';
const vuexLocal = new VuexPersistence({
key: "editor",
storage: localForage,
asyncStorage: true,
reducer: (state) => clone(state),
});
I'm trying to save an Array as state from an api response, i get:
https://i.imgur.com/J5sz2n8.png
Uncaught (in promise) DOMException: Failed to execute 'put' on 'IDBObjectStore': [object Object] could not be cloned. at eval (webpack-internal:///./node_modules/localforage/dist/localforage.js:1044:37) at createTransaction (webpack-internal:///./node_modules/localforage/dist/localforage.js:797:9) at eval (webpack-internal:///./node_modules/localforage/dist/localforage.js:1028:13)
It only happens when trying to save an array, but with strings i dont have any problem
I'm using Ionic Storage v3 wich returns promises, my instance:
Ionic storage:
My dependencies:
Any help pls?, Thanks!.