mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-24 03:43:09 +02:00
ressurect deepcopy
This commit is contained in:
parent
747acd025d
commit
27b48ef96d
3 changed files with 16 additions and 2 deletions
|
@ -31,6 +31,7 @@
|
||||||
"css-loader": "6.7.1",
|
"css-loader": "6.7.1",
|
||||||
"cssnano": "5.1.7",
|
"cssnano": "5.1.7",
|
||||||
"date-fns": "2.28.0",
|
"date-fns": "2.28.0",
|
||||||
|
"deepcopy": "2.1.0",
|
||||||
"escape-regexp": "0.0.1",
|
"escape-regexp": "0.0.1",
|
||||||
"eslint": "8.14.0",
|
"eslint": "8.14.0",
|
||||||
"eslint-plugin-vue": "8.7.1",
|
"eslint-plugin-vue": "8.7.1",
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import { onUnmounted, Ref, ref, toRaw, watch } from 'vue';
|
import { onUnmounted, Ref, ref, watch } from 'vue';
|
||||||
import { $i } from './account';
|
import { $i } from './account';
|
||||||
import { api } from './os';
|
import { api } from './os';
|
||||||
import { get, set } from './scripts/idb-proxy';
|
import { get, set } from './scripts/idb-proxy';
|
||||||
import { defaultStore } from './store';
|
import { defaultStore } from './store';
|
||||||
import { stream } from './stream';
|
import { stream } from './stream';
|
||||||
import { BroadcastChannel } from 'broadcast-channel';
|
import { BroadcastChannel } from 'broadcast-channel';
|
||||||
|
import deepcopy from 'deepcopy';
|
||||||
|
|
||||||
type StateDef = Record<string, {
|
type StateDef = Record<string, {
|
||||||
where: 'account' | 'device' | 'deviceAccount';
|
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> {
|
public set<K extends keyof T>(key: K, value: T[K]['default']): Promise<void> {
|
||||||
// IndexedDBやBroadcastChannelで扱うために単純なオブジェクトにする
|
// IndexedDBやBroadcastChannelで扱うために単純なオブジェクトにする
|
||||||
// (JSON.parse(JSON.stringify(value))の代わり)
|
// (JSON.parse(JSON.stringify(value))の代わり)
|
||||||
const rawValue = structuredClone(toRaw(value));
|
const rawValue = deepcopy(value);
|
||||||
|
|
||||||
if (_DEV_) console.log('set', key, rawValue, value);
|
if (_DEV_) console.log('set', key, rawValue, value);
|
||||||
|
|
||||||
|
|
|
@ -1954,6 +1954,13 @@ deep-is@^0.1.3:
|
||||||
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
|
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
|
||||||
integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=
|
integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=
|
||||||
|
|
||||||
|
deepcopy@2.1.0:
|
||||||
|
version "2.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/deepcopy/-/deepcopy-2.1.0.tgz#2deb0dd52d079c2ecb7924b640a7c3abd4db1d6d"
|
||||||
|
integrity sha512-8cZeTb1ZKC3bdSCP6XOM1IsTczIO73fdqtwa2B0N15eAz7gmyhQo+mc5gnFuulsgN3vIQYmTgbmQVKalH1dKvQ==
|
||||||
|
dependencies:
|
||||||
|
type-detect "^4.0.8"
|
||||||
|
|
||||||
define-properties@^1.1.2, define-properties@^1.1.3:
|
define-properties@^1.1.2, define-properties@^1.1.3:
|
||||||
version "1.1.3"
|
version "1.1.3"
|
||||||
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1"
|
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1"
|
||||||
|
@ -5579,6 +5586,11 @@ type-check@^0.4.0, type-check@~0.4.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
prelude-ls "^1.2.1"
|
prelude-ls "^1.2.1"
|
||||||
|
|
||||||
|
type-detect@^4.0.8:
|
||||||
|
version "4.0.8"
|
||||||
|
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c"
|
||||||
|
integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==
|
||||||
|
|
||||||
type-fest@^0.20.2:
|
type-fest@^0.20.2:
|
||||||
version "0.20.2"
|
version "0.20.2"
|
||||||
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4"
|
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4"
|
||||||
|
|
Loading…
Reference in a new issue