Skip to content

Commit

Permalink
fix(setup): using stateAccessor to get correct state
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanWright committed Aug 10, 2016
1 parent c91665b commit e758803
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/setup.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { getActiveStore, dispatch, actions } from './redux';
import behaviorOnChange from './behavior';
import stateAccessor from './redux/selectors/stateAccessor';

export default function setup(session) {
// Keep track of any server notification
session.subscribe('pv.time.change', (args) => {
const index = args[0].timeStep;
setImmediate(() => {
dispatch(actions.time.storeTime(index));
const state = getActiveStore().getState();
const state = stateAccessor(getActiveStore().getState());
if (state.active.source && state.active.source !== '0') {
// Update proxy data for info tab...
// FIXME implement a lighter implementation on the server side...
Expand All @@ -31,7 +32,7 @@ export default function setup(session) {

// Attach default behavior
getActiveStore().subscribe(() => {
const state = getActiveStore().getState();
const state = stateAccessor(getActiveStore().getState());
behaviorOnChange(state, dispatch);
});
}

0 comments on commit e758803

Please sign in to comment.