Skip to content

Sync base Node/Edge params (label/style/type/...) to the frontend - #71

Merged
philippjfr merged 2 commits into
mainfrom
fix/issue-60-base-param-sync
Aug 26, 2026
Merged

Sync base Node/Edge params (label/style/type/...) to the frontend#71
philippjfr merged 2 commits into
mainfrom
fix/issue-60-base-param-sync

Conversation

@hoxbro

@hoxbro hoxbro commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Description

Assigning label, style, type, className, markerEnd, sourceHandle, or targetHandle on a live Node/Edge instance was a silent no-op: only subclass-defined data params were watched and pushed to the frontend, so base params only reached the DOM after a full flow.nodes/flow.edges reassignment.

  • Node/Edge now declare _TOP_LEVEL_SYNC_PARAMS, the base params that map to top-level React Flow fields rather than arbitrary data keys.
  • Param watcher setup/teardown for nodes and edges is unified into one generic _update_param_watchers/_on_synced_param_change pair instead of four near-duplicate methods.
  • patch_node_data/patch_edge_data split a patch into top-level vs data keys via a shared _apply_data_patch helper, and send that same split ("patch" + "top_patch") to the frontend so reactflow.jsx doesn't need its own copy of which keys are top-level to stay in sync.
  • Also fixes a side effect where patch_edge_data(..., {"label": ...}) left a phantom "label" key in edge.data instead of updating edge.label.

Adds a UI regression test asserting direct attribute assignment updates the DOM immediately, including that style=None clears back to default.

AI Disclosure

Tool & Model: Kilo:anthropic/claude-sonnet-5
Usage:

  • I have tested all AI-generated content in my PR.
  • I take responsibility for all AI-generated content in my PR.

Checklist

  • Tests added and are passing
  • Added documentation
hoxbro and others added 2 commits August 26, 2026 12:48
Assigning label, style, type, className, markerEnd, sourceHandle, or
targetHandle on a live Node/Edge instance was a silent no-op: only
subclass-defined data params were watched and pushed to the frontend,
so base params only reached the DOM after a full flow.nodes/flow.edges
reassignment (fixes hoxbro/panel-multi#60).

- Node/Edge now declare _TOP_LEVEL_SYNC_PARAMS, the base params that map
  to top-level React Flow fields rather than arbitrary data keys.
- Param watcher setup/teardown for nodes and edges is unified into one
  generic _update_param_watchers/_on_synced_param_change pair instead of
  four near-duplicate methods.
- patch_node_data/patch_edge_data split a patch into top-level vs data
  keys via a shared _apply_data_patch helper, and send that same split
  ("patch" + "top_patch") to the frontend so reactflow.jsx doesn't need
  its own copy of which keys are top-level to stay in sync.
- Also fixes a side effect where patch_edge_data(..., {"label": ...})
  left a phantom "label" key in edge.data instead of updating edge.label.

Adds a UI regression test asserting direct attribute assignment updates
the DOM immediately, including that style=None clears back to default.

Assisted-by: Kilo:anthropic/claude-sonnet-5
@philippjfr
philippjfr marked this pull request as ready for review August 26, 2026 13:39
@philippjfr
philippjfr merged commit d98b54f into main Aug 26, 2026
17 checks passed
@philippjfr
philippjfr deleted the fix/issue-60-base-param-sync branch August 26, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants