From b2f026c212466b39dbceb4818576d63b5a81aca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Tue, 27 Feb 2024 17:56:01 -0600 Subject: [PATCH] fix: persist settings --- src/stores/app.ts | 3 ++- src/stores/session.ts | 3 ++- src/stores/tankopedia.ts | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/stores/app.ts b/src/stores/app.ts index 1c1366937..e615eb1f9 100644 --- a/src/stores/app.ts +++ b/src/stores/app.ts @@ -1,3 +1,4 @@ +import { merge } from 'lodash'; import { create } from 'zustand'; import { persist } from 'zustand/middleware'; @@ -10,6 +11,6 @@ export const useApp = create()( (set) => ({ devBuildAgreementTime: 0, }), - { name: 'app' }, + { name: 'app', merge: (a, b) => merge(b, a) }, ), ); diff --git a/src/stores/session.ts b/src/stores/session.ts index ffc8b46c9..3a2011e9f 100644 --- a/src/stores/session.ts +++ b/src/stores/session.ts @@ -1,4 +1,5 @@ import { produce } from 'immer'; +import { merge } from 'lodash'; import { create } from 'zustand'; import { persist } from 'zustand/middleware'; import { CustomColumnDisplay } from '../app/tools/session/components/CustomColumn'; @@ -83,7 +84,7 @@ export const useSession = create()( ], color: 'slate', }), - { name: 'session' }, + { name: 'session', merge: (a, b) => merge(b, a) }, ), ); diff --git a/src/stores/tankopedia.ts b/src/stores/tankopedia.ts index 817492ab1..5b08f2437 100644 --- a/src/stores/tankopedia.ts +++ b/src/stores/tankopedia.ts @@ -128,7 +128,7 @@ export const useTankopediaPersistent = create()( }, mode: isDev() ? 'armor' : 'model', })), - { name: 'tankopedia', merge }, + { name: 'tankopedia', merge: (a, b) => merge(b, a) }, ), );