-
Notifications
You must be signed in to change notification settings - Fork 712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Pods number in graph not updating (minor label) #2728
Conversation
@@ -402,7 +402,7 @@ function cloneLayout(layout, nodes, edges) { | |||
function copyLayoutProperties(layout, nodeCache, edgeCache) { | |||
const result = Object.assign({}, layout); | |||
result.nodes = layout.nodes.map(node => (nodeCache.has(node.get('id')) | |||
? node.merge(nodeCache.get(node.get('id'))) : node)); | |||
? nodeCache.get(node.get('id')).merge(node) : node)); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
By only caching layout values (x, y). Fixes #2401.
d2c341c
to
e2d5a2a
Compare
Actually,
The problem is that except for the So, to make sure nothing is broken I think we could do one of the following:
I think a quick fix would be to go with 1 but it's important to note that we'd still be assuming that ranks are immutable, which deserves a comment in the code even if it's always true. Edit: I opened #2733 when we get some extra time to restructure that code on a more ground-level. In the meantime, I think a quick fix in this PR that fixes the bug is ok. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rank
field still needs to be considered.
@@ -487,7 +487,7 @@ export function doLayout(immNodes, immEdges, opts) { | |||
|
|||
// cache results | |||
cache.cachedLayout = layout; | |||
cache.nodeCache = cache.nodeCache.merge(layout.nodes); | |||
cache.nodeCache = cache.nodeCache.merge(layout.nodes.map(n => fromJS({ x: n.get('x'), y: n.get('y') }))); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
// only cache layout-related properties | ||
// NB: These properties must be immutable wrt a given node because properties of updated nodes | ||
// will be overwritten with the cached values, see copyLayoutProperties() | ||
cache.nodeCache = cache.nodeCache.merge(layout.nodes.map(n => pick(n.toJS(), ['x', 'y', 'rank']))); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
bcd81aa
to
96265a4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Fixes #2401.