diff --git a/lib/gui/models/store.js b/lib/gui/models/store.js index 0d5979c3..035668f8 100644 --- a/lib/gui/models/store.js +++ b/lib/gui/models/store.js @@ -38,7 +38,7 @@ const DEFAULT_STATE = Immutable.fromJS({ } }); -module.exports = redux.createStore(function(state, action) { +const store = function(state, action) { state = state || DEFAULT_STATE; switch (action.type) { @@ -58,7 +58,9 @@ module.exports = redux.createStore(function(state, action) { if (selectedDevice && !_.find(action.data, { device: selectedDevice })) { - return newState.deleteIn([ 'selection', 'drive' ]); + return store(newState, { + type: 'REMOVE_DRIVE' + }); } return newState; @@ -150,4 +152,6 @@ module.exports = redux.createStore(function(state, action) { } } -}); +}; + +module.exports = redux.createStore(store);