Skip to content

Fix two undo steps on add node via context menu#3674

Merged
huchenlei merged 2 commits intomainfrom
two-undo
Apr 29, 2025
Merged

Fix two undo steps on add node via context menu#3674
huchenlei merged 2 commits intomainfrom
two-undo

Conversation

@webfiltered
Copy link
Contributor

@webfiltered webfiltered commented Apr 28, 2025

Removes change tracker monkey patch on LGraph.onNodeAdded.

┆Issue is synchronized with this Notion page by Unito

@webfiltered webfiltered requested a review from a team as a code owner April 28, 2025 20:30
Copy link
Contributor

@huchenlei huchenlei left a comment

Choose a reason for hiding this comment

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

I am not so sure whether teh onNodeAdded hook can be removed, as it seems to also detect the add node controlled by script. Can you further explain which other place is also checking the state when adding node via searchbox?

@webfiltered
Copy link
Contributor Author

checking the state when adding node via searchbox

Not sure if I misread, but there's an addition in this PR on NodeSearchBoxPopover.vue - when the search box actually adds a node, that method now calls changeTracker immediately after.

As for anything else using onNodeAdded, it is very likely doubling up on the pointerup / keyup checks. Unless nodes are being added without any user interaction... but if that's the case, should an undo step be created every time graph.add(node) is called?

@huchenlei huchenlei merged commit 0481560 into main Apr 29, 2025
10 checks passed
@huchenlei huchenlei deleted the two-undo branch April 29, 2025 15:23
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