Skip to content

fix: Re-measure a node's handles when its style changes - #99

Merged
philippjfr merged 1 commit into
mainfrom
fix/remeasure-handles-on-style
Nov 20, 2026
Merged

philippjfr merged 1 commit into
mainfrom
fix/remeasure-handles-on-style

Conversation

@philippjfr

Copy link
Copy Markdown
Contributor

A handle whose top reads a CSS variable from the node's style (e.g. "var(--port-top, 52px)") moves when patch_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 its style, and documented that a handle's top may 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.

@philippjfr
philippjfr marked this pull request as ready for review November 20, 2026 03:55
@philippjfr
philippjfr merged commit f61dc96 into main Nov 20, 2026
31 of 32 checks passed
@philippjfr
philippjfr deleted the fix/remeasure-handles-on-style branch November 20, 2026 03:55
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.

1 participant