mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 18:20:27 +00:00
Fixes metrics-on-canvas updating.
- We were being a bit overzealous w/ our layout caching.
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user