From 7a6068d7be3d875a612b0d088f0231df8fa2af19 Mon Sep 17 00:00:00 2001 From: Muhsin Shah Date: Thu, 23 May 2024 19:32:02 +0530 Subject: [PATCH] Changed currentState update func to the not reset constants state --- frontend/src/_stores/currentStateStore.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/src/_stores/currentStateStore.js b/frontend/src/_stores/currentStateStore.js index c111f77311..98201873f2 100644 --- a/frontend/src/_stores/currentStateStore.js +++ b/frontend/src/_stores/currentStateStore.js @@ -55,7 +55,14 @@ export const useCurrentStateStore = create( }, setEditorReady: (isEditorReady) => set({ isEditorReady }), initializeCurrentStateOnVersionSwitch: () => { - set({ ...initialState }, false, { type: 'INITIALIZE_CURRENT_STATE_ON_VERSION_SWITCH', initialState }); + const newInitialState = { + ...initialState, + constants: get().constants, + }; + set({ ...newInitialState }, false, { + type: 'INITIALIZE_CURRENT_STATE_ON_VERSION_SWITCH', + newInitialState, + }); }, }, }),