Reset nodes in frontend when scope-app restarted

When the scope-app restarts, it no longer has a
reference to the previous node set. Therefore,
the delta update adds *all* nodes but does not
remove legacy ones.

`reset==true` tells the frontend to start fresh.

Fixes #2708
This commit is contained in:
Roland Schilter
2017-07-13 14:19:11 +02:00
parent e603a28ca4
commit 5329efa528
4 changed files with 25 additions and 3 deletions

View File

@@ -551,7 +551,7 @@ export function receiveNodesDelta(delta) {
dispatch({ type: ActionTypes.FINISH_TIME_TRAVEL_TRANSITION });
}
const hasChanges = delta.add || delta.update || delta.remove;
const hasChanges = delta.add || delta.update || delta.remove || delta.reset;
if (hasChanges) {
dispatch({
type: ActionTypes.RECEIVE_NODES_DELTA,

View File

@@ -582,7 +582,12 @@ export function rootReducer(state = initialState, action) {
log('RECEIVE_NODES_DELTA',
'remove', size(action.delta.remove),
'update', size(action.delta.update),
'add', size(action.delta.add));
'add', size(action.delta.add),
'reset', action.delta.reset);
if (action.delta.reset) {
state = state.set('nodes', makeMap());
}
// remove nodes that no longer exist
each(action.delta.remove, (nodeId) => {