diff --git a/client/app/scripts/charts/nodes-chart.js b/client/app/scripts/charts/nodes-chart.js index f7ec690eb..df4a5f887 100644 --- a/client/app/scripts/charts/nodes-chart.js +++ b/client/app/scripts/charts/nodes-chart.js @@ -63,8 +63,9 @@ export default class NodesChart extends React.Component { // wipe node states when showing different topology if (nextProps.topologyId !== this.props.topologyId) { - // re-apply cached canvas zoom/pan to d3 behavior - const nextZoom = this.state.zoomCache[nextProps.topologyId]; + // re-apply cached canvas zoom/pan to d3 behavior (or set defaul values) + const defaultZoom = { scale: 1, panTranslateX: 0, panTranslateY: 0, hasZoomed: false }; + const nextZoom = this.state.zoomCache[nextProps.topologyId] || defaultZoom; if (nextZoom) { this.zoom.scale(nextZoom.scale); this.zoom.translate([nextZoom.panTranslateX, nextZoom.panTranslateY]);