fix nodes immutable after socket opens

fix for PR #410
This commit is contained in:
David Kaltschmidt
2015-09-02 16:38:24 +02:00
parent 001e041f0d
commit e8ec3ed5fc
2 changed files with 3 additions and 9 deletions

View File

@@ -60,11 +60,6 @@ describe('AppStore', function() {
type: ActionTypes.OPEN_WEBSOCKET
};
const ReceiveEmptyNodesDeltaAction = {
type: ActionTypes.RECEIVE_NODES_DELTA,
delta: {}
};
const ReceiveNodesDeltaAction = {
type: ActionTypes.RECEIVE_NODES_DELTA,
delta: {
@@ -189,12 +184,12 @@ describe('AppStore', function() {
registeredCallback(CloseWebsocketAction);
expect(AppStore.isWebsocketClosed()).toBeTruthy();
// keep showing old nodes
expect(AppStore.getNodes().toJS()).toEqual(NODE_SET);
registeredCallback(OpenWebsocketAction);
expect(AppStore.isWebsocketClosed()).toBeFalsy();
registeredCallback(ReceiveEmptyNodesDeltaAction);
// opened socket clears nodes
expect(AppStore.getNodes().toJS()).toEqual({});
});

View File

@@ -176,7 +176,6 @@ AppStore.registeredCallback = function(payload) {
break;
case ActionTypes.CLOSE_WEBSOCKET:
nodes = nodes.clear();
websocketClosed = true;
AppStore.emit(AppStore.CHANGE_EVENT);
break;
@@ -209,7 +208,7 @@ AppStore.registeredCallback = function(payload) {
case ActionTypes.OPEN_WEBSOCKET:
// flush nodes cache after re-connect
nodes = {};
nodes = nodes.clear();
websocketClosed = false;
AppStore.emit(AppStore.CHANGE_EVENT);