From 9929c10e5ea6a8182a99326c252fbc19bd9f390b Mon Sep 17 00:00:00 2001 From: remo5000 Date: Wed, 23 May 2018 13:47:27 +0800 Subject: [PATCH] Remove mutation of state in HANLDE_CONSOLE_LOG --- src/reducers/playground.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/reducers/playground.ts b/src/reducers/playground.ts index c42e4a45ab..41a887a269 100644 --- a/src/reducers/playground.ts +++ b/src/reducers/playground.ts @@ -55,8 +55,11 @@ export const reducer: Reducer = (state = defaultPlayground, ac consoleLogs: [action.payload] }) } else { - lastOutput.consoleLogs = lastOutput.consoleLogs.concat(action.payload) - newOutput = state.output.slice(0, -1).concat(lastOutput) + const updatedLastOutput = { + type: lastOutput.type, + consoleLogs: lastOutput.consoleLogs.concat(action.payload) + } + newOutput = state.output.slice(0, -1).concat(updatedLastOutput) } return { ...state,