From b3052f017889e146869c0a48eda377795692737b Mon Sep 17 00:00:00 2001 From: Abdullah Adeel <64294045+mabdullahadeel@users.noreply.github.com> Date: Thu, 1 Sep 2022 15:11:44 +0500 Subject: [PATCH] fix: #5622 - prevent session theme reset during collaboration (#5640) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ✅ fixed #5622 - prevent session theme reset - ❌ prevent newly initialized state to override theme preferences. - 🔧 fix for #5622 * refactor Co-authored-by: Aakansha Doshi --- src/excalidraw-app/index.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/excalidraw-app/index.tsx b/src/excalidraw-app/index.tsx index 896c96d98..ebe6ed8eb 100644 --- a/src/excalidraw-app/index.tsx +++ b/src/excalidraw-app/index.tsx @@ -194,7 +194,13 @@ const initializeScene = async (opts: { scene: { ...scene, appState: { - ...restoreAppState(scene?.appState, excalidrawAPI.getAppState()), + ...restoreAppState( + { + ...scene?.appState, + theme: localDataState?.appState?.theme || scene?.appState?.theme, + }, + excalidrawAPI.getAppState(), + ), // necessary if we're invoking from a hashchange handler which doesn't // go through App.initializeScene() that resets this flag isLoading: false,