Skip to content

Commit

Permalink
fix(redux): add new action to reset state
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanWright committed Aug 10, 2016
1 parent e758803 commit 65dc33b
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/redux/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@ import * as time from './ducks/time';
import * as view from './ducks/view';
import * as ui from './ducks/ui';

function resetVisualizerState() {
return { type: 'RESET_VISUALIZER_STATE' };
}

export default {
active,
colors,
files,
network,
proxies,
resetVisualizerState,
save,
time,
view,
Expand Down
4 changes: 4 additions & 0 deletions src/redux/ducks/active.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export default function reducer(state = initialState, action) {
return Object.assign({}, state, { [action.name]: action.id });
}

case 'RESET_VISUALIZER_STATE': {
return initialState;
}

default:
return state;
}
Expand Down
4 changes: 4 additions & 0 deletions src/redux/ducks/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ export default function reducer(state = initialState, action) {
return Object.assign({}, state, { piecewiseFunctionsToPush });
}

case 'RESET_VISUALIZER_STATE': {
return initialState;
}

default:
return state;
}
Expand Down
4 changes: 4 additions & 0 deletions src/redux/ducks/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ export default function reducer(state = initialState, action) {
return Object.assign({}, state, { activePath });
}

case 'RESET_VISUALIZER_STATE': {
return initialState;
}

default:
return state;
}
Expand Down
4 changes: 4 additions & 0 deletions src/redux/ducks/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ export default function reducer(state = initialState, action) {
return Object.assign({}, state, { requests, success, error });
}

case 'RESET_VISUALIZER_STATE': {
return initialState;
}

default:
return state;
}
Expand Down
4 changes: 4 additions & 0 deletions src/redux/ducks/proxies.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ export default function reducer(state = initialState, action) {
return Object.assign({}, state, { proxies });
}

case 'RESET_VISUALIZER_STATE': {
return initialState;
}

default:
return state;
}
Expand Down
4 changes: 4 additions & 0 deletions src/redux/ducks/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ export default function proxiesReducer(state = initialState, action) {
return Object.assign({}, state, { paths });
}

case 'RESET_VISUALIZER_STATE': {
return initialState;
}

default:
return state;
}
Expand Down
4 changes: 4 additions & 0 deletions src/redux/ducks/time.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ export default function reducer(state = initialState, action) {
return Object.assign({}, state, { playing: !!action.play });
}

case 'RESET_VISUALIZER_STATE': {
return initialState;
}

default:
return state;
}
Expand Down
4 changes: 4 additions & 0 deletions src/redux/ducks/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export default function reducer(state = initialState, action) {
return Object.assign({}, state, { collapsableState });
}

case 'RESET_VISUALIZER_STATE': {
return initialState;
}

default:
return state;
}
Expand Down

0 comments on commit 65dc33b

Please sign in to comment.