ressurect deepcopy

This commit is contained in:
tamaina
2022-05-01 05:15:01 +00:00
parent 747acd025d
commit 27b48ef96d
3 changed files with 16 additions and 2 deletions

View File

@@ -1,10 +1,11 @@
import { onUnmounted, Ref, ref, toRaw, watch } from 'vue';
import { onUnmounted, Ref, ref, watch } from 'vue';
import { $i } from './account';
import { api } from './os';
import { get, set } from './scripts/idb-proxy';
import { defaultStore } from './store';
import { stream } from './stream';
import { BroadcastChannel } from 'broadcast-channel';
import deepcopy from 'deepcopy';
type StateDef = Record<string, {
where: 'account' | 'device' | 'deviceAccount';
@@ -153,7 +154,7 @@ export class Storage<T extends StateDef> {
public set<K extends keyof T>(key: K, value: T[K]['default']): Promise<void> {
// IndexedDBやBroadcastChannelで扱うために単純なオブジェクトにする
// (JSON.parse(JSON.stringify(value))の代わり)
const rawValue = structuredClone(toRaw(value));
const rawValue = deepcopy(value);
if (_DEV_) console.log('set', key, rawValue, value);