Repository navigation
fix: Re-measure a node's handles when its style changes - #99
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A handle whose
topreads a CSS variable from the node'sstyle(e.g."var(--port-top, 52px)") moves whenpatch_node_props()changes that variable, but its edges stayed at the old position. React Flow measures handle positions only when a node is created or resized, so a style change that moves handles without resizing the node left the edges detached until something else resized it. panel-flowdash hits this when a card collapses or folds its optional inputs: the handles move through such variables, and the edges float off them.I made each node re-measure its handles (
updateNodeInternals) after a change to itsstyle, and documented that a handle'stopmay read a CSS variable set per node. Nothing changes for nodes whose style does not change, so dragging, selecting and zooming do no extra work.I added a UI test that moves a handle by patching only the node's style and checks the edge end follows it, there and back. It fails on main (the edge stays at the old position) and passes with the change. The full unit (387) and UI (156) suites pass locally.