Merge pull request #2906 from weaveworks/2858-prevent-zooming-nan-errors

Try to prevent zooming NaN errors
This commit is contained in:
Filip Barl
2017-10-24 16:15:04 +02:00
committed by GitHub
2 changed files with 4 additions and 2 deletions

View File

@@ -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)),
};
}

View File

@@ -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()