Skip to content
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 #240 - cannot delete nodes with multiple graphs. #246

Merged
merged 1 commit into from
Aug 5, 2020

Conversation

ajbogh
Copy link
Contributor

@ajbogh ajbogh commented Aug 5, 2020

Peek 2020-08-05 12-35

@@ -425,7 +425,7 @@ class Edge extends React.Component<IEdgeProps> {
) {
let response = Edge.getDefaultIntersectResponse();

if (trg[nodeKey] == null) {
if (trg == null || trg[nodeKey] == null) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes a minor console error that shows up when a node is deleted and the connected edges try to calculate their positions.

const timeoutId = `nodes-${nodeId}`;

// cancel an asyncRenderNode animation
cancelAnimationFrame(this.nodeTimeouts[timeoutId]);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the race condition bug by cancelling the asyncRenderNode method. Now nodes are deleted and stay deleted.

@@ -605,7 +612,7 @@ class GraphView extends React.Component<IGraphViewProps, IGraphViewState> {
}
};

handleEdgeSelected = e => {
handleEdgeSelected = (e: any) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor flowtype redline fix.

@@ -25,6 +25,7 @@ export type IEdgeType = IEdge;
export { default as GraphUtils } from './utilities/graph-util';
export { default as Node } from './components/node';
export type INodeType = INode;
// eslint-disable-next-line prettier/prettier
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes an annoying problem with prettier trying to fix the line breaks when it doesn't need to.

@ajbogh ajbogh merged commit 07f2e04 into uber:master Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants