Explorar el Código

fix: settings not saved in firefox

Ahmad Kholid hace 2 años
padre
commit
09761d963b
Se han modificado 1 ficheros con 4 adiciones y 2 borrados
  1. 4 2
      src/lib/pinia.js

+ 4 - 2
src/lib/pinia.js

@@ -1,4 +1,4 @@
-import { markRaw, toRaw } from 'vue';
+import { markRaw } from 'vue';
 import { createPinia } from 'pinia';
 import browser from 'webextension-polyfill';
 
@@ -9,7 +9,9 @@ function saveToStoragePlugin({ store, options }) {
     const storageKey = options.storageMap[key];
     if (!storageKey || !store.retrieved) return null;
 
-    return newBrowser.storage.local.set({ [storageKey]: toRaw(store[key]) });
+    const value = JSON.parse(JSON.stringify(store[key]));
+
+    return newBrowser.storage.local.set({ [storageKey]: value });
   };
 }