From 5eb5e3f774071edf6eb9ff15a9f2a1c06b2bacba Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Thu, 11 Oct 2018 13:07:58 +0200 Subject: [PATCH] close modal on DEVICE.CONNECT action --- src/reducers/ModalReducer.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/reducers/ModalReducer.js b/src/reducers/ModalReducer.js index 6f033699..a425676a 100644 --- a/src/reducers/ModalReducer.js +++ b/src/reducers/ModalReducer.js @@ -52,6 +52,15 @@ export default function modal(state: State = initialState, action: Action): Stat } return state; + // device connected + // close modal if modal context is not 'device' + case DEVICE.CONNECT: + case DEVICE.CONNECT_UNACQUIRED: + if (state.context !== MODAL.CONTEXT_DEVICE) { + return initialState; + } + return state; + // device with context assigned to modal was disconnected // close modal case DEVICE.DISCONNECT: