diff options
author | Victor Chabbert <chabbertvi@eisti.eu> | 2017-01-22 18:34:14 +0100 |
---|---|---|
committer | Victor Chabbert <chabbertvi@eisti.eu> | 2017-01-22 19:28:49 +0100 |
commit | 0c9e9480471848a4b8670da22b609535cb153ff3 (patch) | |
tree | e59256cb6e8ec6b1041db8ed9902f89e4c39d2e2 /frontend/src/redux | |
parent | Add notification for updated game to /topics/games (diff) | |
download | seven-wonders-0c9e9480471848a4b8670da22b609535cb153ff3.tar.gz seven-wonders-0c9e9480471848a4b8670da22b609535cb153ff3.tar.bz2 seven-wonders-0c9e9480471848a4b8670da22b609535cb153ff3.zip |
Made redux store fully immutable
Diffstat (limited to 'frontend/src/redux')
-rw-r--r-- | frontend/src/redux/app.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/frontend/src/redux/app.js b/frontend/src/redux/app.js new file mode 100644 index 00000000..172dc960 --- /dev/null +++ b/frontend/src/redux/app.js @@ -0,0 +1,15 @@ +export const makeSelectLocationState = () => { + let prevRoutingState; + let prevRoutingStateJS; + + return (state) => { + const routingState = state.get('routing') + + if (!routingState.equals(prevRoutingState)) { + prevRoutingState = routingState + prevRoutingStateJS = routingState.toJS() + } + + return prevRoutingStateJS; + } +} |