Fixes metrics-on-canvas updating.

- We were being a bit overzealous w/ our layout caching.
This commit is contained in:
Simon Howe
2016-08-25 17:46:47 +02:00
parent 94cd73c72b
commit cf6d703c18
2 changed files with 2 additions and 11 deletions

View File

@@ -12,8 +12,7 @@ import { MIN_NODE_SIZE, DETAILS_PANEL_WIDTH, MAX_NODE_SIZE } from '../constants/
import Logo from '../components/logo';
import { doLayout } from './nodes-layout';
import NodesChartElements from './nodes-chart-elements';
import { getActiveTopologyOptions, getAdjacentNodes,
isSameTopology } from '../utils/topology-utils';
import { getActiveTopologyOptions, getAdjacentNodes } from '../utils/topology-utils';
const log = debug('scope:nodes-chart');
@@ -82,8 +81,7 @@ class NodesChart extends React.Component {
state.height = nextProps.forceRelayout ? nextProps.height : (state.height || nextProps.height);
state.width = nextProps.forceRelayout ? nextProps.width : (state.width || nextProps.width);
// _.assign(state, this.updateGraphState(nextProps, state));
if (nextProps.forceRelayout || !isSameTopology(nextProps.nodes, this.props.nodes)) {
if (nextProps.forceRelayout || nextProps.nodes !== this.props.nodes) {
_.assign(state, this.updateGraphState(nextProps, state));
}

View File

@@ -171,13 +171,6 @@ export function getCurrentTopologyUrl(state) {
return state.getIn(['currentTopology', 'url']);
}
export function isSameTopology(nodes, nextNodes) {
const mapper = node => makeMap({id: node.get('id'), adjacency: node.get('adjacency')});
const topology = nodes.map(mapper);
const nextTopology = nextNodes.map(mapper);
return isDeepEqual(topology, nextTopology);
}
export function isNodeMatchingQuery(node, query) {
return node.get('label').includes(query) || node.get('subLabel').includes(query);
}