-
Notifications
You must be signed in to change notification settings - Fork 1
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
EAGLE-1343: Graph edges can't be deleted after deleting ports #775
Conversation
…an work directly on the edges observableArray.
Reviewer's Guide by SourceryThe PR fixes an issue with graph edge deletion after port removal by moving the Sequence diagram for removing a field from a nodesequenceDiagram
actor User
participant LogicalGraph
participant Node
participant Edge
participant Eagle
User->>LogicalGraph: removeFieldFromNodeById(node, id)
LogicalGraph->>Node: removeFieldById(id)
LogicalGraph->>Edge: Check edges for id
Edge-->>LogicalGraph: Return edges with id
LogicalGraph->>Edge: Remove edges with id
LogicalGraph->>Eagle: checkGraph()
LogicalGraph->>Eagle: undo().pushSnapshot()
LogicalGraph->>Eagle: flagActiveFileModified()
LogicalGraph->>Eagle: selectedObjects.valueHasMutated()
Updated class diagram for LogicalGraph and Eagle classesclassDiagram
class LogicalGraph {
+removeFieldFromNodeById(node: Node, id: FieldId)
+portIsLinked(nodeId: NodeId, portId: FieldId)
...
}
class Eagle {
-removeFieldFromNodeById(node: Node, id: string)
+nodeDropLogicalGraph(eagle: Eagle, event: JQuery.TriggeredEvent)
...
}
LogicalGraph --> Eagle : uses
note for LogicalGraph "Moved removeFieldFromNodeById from Eagle to LogicalGraph"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @james-strauss-uwa - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
node.removeFieldById(id); | ||
|
||
// remove any edges connected to that port | ||
const edges: ko.ObservableArray<Edge> = this.edges; |
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.
suggestion (performance): Consider caching the edges array value outside the loop to avoid repeated observable access
Instead of calling edges() multiple times in the loop, store the array once with const edgesArray = edges();
and use that in the loop. This will be more efficient and clearer to read.
const edges: ko.ObservableArray<Edge> = this.edges;
const edgesArray = edges();
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.
No, I think this is fine, we want to cache the edges observableArray
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.
Thank you for your feedback, we will generate fewer comments like this in the future according to the following instructions:
- Ensure the comment provides a clear and actionable suggestion for improving code performance.
- Verify that the comment includes a specific example or code snippet to illustrate the suggestion.
- Check that the comment is relevant to the code being reviewed and addresses a potential issue or improvement.
- Avoid comments that are overly prescriptive without considering the context or potential trade-offs.
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.
looks good
Moved removeFieldFromNodeById from Eagle.ts to LogicalGraph.ts so that it can work directly on the edges observableArray instead of working on a array copy provided by LogicalGraph.getEdges()
Minor update to the Utils.printLogicalGraphEdgesTable() to add some more information.
Summary by Sourcery
Enhancements: