fix: bugs

This commit is contained in:
qier222 2022-04-29 19:16:34 +08:00
parent ffdf66b57e
commit d3e44541fb
No known key found for this signature in database
GPG key ID: 9C85007ED905F14D
17 changed files with 799 additions and 469 deletions

View file

@ -1,6 +1,7 @@
import { proxy, subscribe } from 'valtio'
import { devtools } from 'valtio/utils'
import { Player } from '@/renderer/utils/player'
import {merge} from 'lodash-es'
interface Store {
uiStates: {
@ -26,7 +27,7 @@ const initialState: Store = {
const stateInLocalStorage = localStorage.getItem('state')
export const state = proxy<Store>(
(stateInLocalStorage && JSON.parse(stateInLocalStorage)) || initialState
merge(initialState, stateInLocalStorage ? JSON.parse(stateInLocalStorage) : {})
)
subscribe(state, () => {
localStorage.setItem('state', JSON.stringify(state))