From adea60b07eb9b90b4c098a138257fc370acb1a8e Mon Sep 17 00:00:00 2001 From: Filip Barl Date: Mon, 23 Oct 2017 16:28:46 +0200 Subject: [PATCH 1/2] Set initial viewport size in global state. --- client/app/scripts/reducers/root.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/app/scripts/reducers/root.js b/client/app/scripts/reducers/root.js index 9bbe144f1..1cfafc5bf 100644 --- a/client/app/scripts/reducers/root.js +++ b/client/app/scripts/reducers/root.js @@ -88,7 +88,8 @@ export const initialState = makeMap({ topologyViewMode: GRAPH_VIEW_MODE, version: '...', versionUpdate: null, - viewport: makeMap(), + // Set some initial numerical values to prevent NaN in case of edgy race conditions. + viewport: makeMap({ width: 0, height: 0 }), websocketClosed: false, zoomCache: makeMap(), serviceImages: makeMap() From 35c814e9120c7c01a51b4cced3e2d31c512d9ab2 Mon Sep 17 00:00:00 2001 From: Filip Barl Date: Mon, 23 Oct 2017 16:39:34 +0200 Subject: [PATCH 2/2] Make sure only proper numerical values are cached. --- client/app/scripts/actions/app-actions.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/app/scripts/actions/app-actions.js b/client/app/scripts/actions/app-actions.js index 1cd740407..03350c590 100644 --- a/client/app/scripts/actions/app-actions.js +++ b/client/app/scripts/actions/app-actions.js @@ -405,7 +405,8 @@ export function clickTopology(topologyId) { export function cacheZoomState(zoomState) { return { type: ActionTypes.CACHE_ZOOM_STATE, - zoomState + // Make sure only proper numerical values are cached. + zoomState: zoomState.filter(value => !window.isNaN(value)), }; }