From bf09d9c3d0b6b8a51e4af5c217a78f4305ac989c Mon Sep 17 00:00:00 2001 From: Luke Schlangen <lukeschlangen@gmail.com> Date: Sun, 3 Feb 2019 11:55:32 -0600 Subject: [PATCH] retain showBranding after SET_FULL_SCREEN --- src/reducers/mode.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/reducers/mode.js b/src/reducers/mode.js index e07b0cda0..cb29e763a 100644 --- a/src/reducers/mode.js +++ b/src/reducers/mode.js @@ -2,26 +2,24 @@ const SET_FULL_SCREEN = 'scratch-gui/mode/SET_FULL_SCREEN'; const SET_PLAYER = 'scratch-gui/mode/SET_PLAYER'; const initialState = { + isAdmin: true, showBranding: false, isFullScreen: false, isPlayerOnly: false, hasEverEnteredEditor: true }; -const reducer = function (state, action) { - if (typeof state === 'undefined') state = initialState; +const reducer = function (state = initialState, action) { switch (action.type) { case SET_FULL_SCREEN: - return { - isFullScreen: action.isFullScreen, - isPlayerOnly: state.isPlayerOnly - }; + return Object.assign(state, { + isFullScreen: action.isFullScreen + }); case SET_PLAYER: - return { - isFullScreen: state.isFullScreen, + return Object.assign(state, { isPlayerOnly: action.isPlayerOnly, hasEverEnteredEditor: state.hasEverEnteredEditor || !action.isPlayerOnly - }; + }); default: return state; } -- GitLab