Release Notes¶
Version 0.6.1¶
A performance release for graphs whose nodes render Panel views. Selecting a node, adding nodes and syncing a large graph no longer cost time proportional to the size of the graph, so such graphs stay responsive.
Bug fixes¶
- Large graphs with node views stay responsive: views of unchanged nodes are no longer rebuilt or re-processed on every interaction, and the frontend does less work per render when a node is selected (#102).
Version 0.6.0¶
This release makes the graph model stricter and more robust. Adding nodes and edges now validates ids, endpoints and data up front, a failing callback no longer interrupts event processing, and the frontend no longer drops messages in debounce mode or re-renders every node on each interaction. It also adds group nodes, fit_view(), batch adds, self-loop edges, binary file drops and selection in read-only graphs. Please review the breaking and behavior changes before upgrading.
Breaking changes¶
-
Stricter graph edits:
add_node(),add_nodes(),add_edge()andadd_edges()raise aValueErrorfor an id that is already in use, an edge whosesourceortargetis missing or not a node of the graph, and data that cannot be sent to the browser (arbitrary objects, sets, dataclasses; NumPy values and datetimes are fine). Previously such nodes and edges were added and broke rendering or later lookups. The same data check applies topatch_node_data(),patch_edge_data()andpatch_*_props(). Add nodes before the edges that connect them. Graphs passed to the constructor only log a warning for duplicate ids and dangling edges, and direct assignment tonodes/edgesis not checked (#90). -
Validators check browser edges: connection validators registered with
add_connection_validator()run again on the final connection when the browser reports a new edge (edge_added), not only while dragging. A rejected edge is not added toflow.edges, noedge_addedevent fires, and the browser removes the edge it drew (edge_rejectedmessage). The same happens whenadd_edge()raises for an edge from the browser. A browser edge whose id collides with an existing edge gets a fresh id instead (#90). -
Callback errors are logged: exceptions raised by event callbacks registered with
flow.on()and byNode/Edgehooks are logged on thepanel.reactflowlogger instead of propagating, and the remaining callbacks still run. Code that relied on a callback exception abortingadd_node(),remove_node()and similar calls must check state explicitly (#90). -
Edge editors are opt-in: selecting an edge no longer opens a raw JSON editor by default. An edge gets an editor only when its
Edgesubclass overrideseditor,edge_editors[type]ordefault_edge_editoris set, or its type defines a schema with properties, matching how node editors are resolved. Passdefault_edge_editor=SchemaEditorto restore the previous behavior (#81).
Highlights¶
-
Group nodes: nodes can be nested through
parentId, withextent,expandParent,hiddenandzIndexnow fields ofNodeSpecandNodethatpatch_node_props()accepts. A built-in"group"node type draws a frame around its children that collapses into a compact node, re-drawing edges into hidden children to the group's handles.group_nodes(),ungroup(),set_parent(),collapse_group()/expand_group()andabsolute_position()manage groups from Python, withnodes_grouped,nodes_ungroupedandgroup_toggledevents. Withgroup_delete="ungroup", deleting a group in the browser or withremove_node()keeps its children and moves them, with their edges and canvas positions, to the group's parent. See Group Nodes (#95, #96). -
Fit the view from Python:
flow.fit_view()pans and zooms the canvas to fit every node, or a subset withflow.fit_view("a", "b", padding=0.2), and accepts React Flow'sfitViewoptions such asdurationandmax_zoom. A fit requested right after replacingnodes, including insidepn.io.hold(), waits for the new nodes to reach the browser. See Fit the graph into view (#80). -
Self-loop edges: an edge whose
sourceandtargetare the same node now renders as a loop around the node instead of a flat path hidden behind it. Every built-in edge type and custom edge types get the loop, several loops on one node stack outward, andconnection_validation={"cycles": True}still rejects them. See Self-loops (#82). -
Selection in read-only graphs:
editable=Falseno longer turns off selection, so read-only diagrams can be clicked to select andselection_changedfires. The newselectableparameter (Trueby default) turns selection off; disabling it at runtime clears the selection (#85). -
Faster structural updates: adding, removing and assigning nodes and edges no longer re-renders every embedded view and editor, and node and edge editors are built only when shown (toolbar editors on first open, side panel and edge editors on selection). In the browser, dragging a node or zooming no longer re-renders every node: dragging one node 60 times in a 1,500 node graph went from about 91,000 node renders to 62, and an update to one node's embedded view re-renders only that node (#88, #89, #94).
Enhancements¶
-
Batch graph edits:
add_nodes()andadd_edges()add many nodes or edges in a single update, validating all of them first, and emit onenode_added/edge_addedevent per item (#89). -
Refused connections: dropping a dragged connection onto a handle that refuses it emits a
connection_refusedevent with the connection and the reason, so an application can say why nothing was drawn. See Explain a refused drop (#98). -
Handle positions: an input or output handle dict accepts a
top, in px for a number or as a CSS length for a string, to line a handle up with a port drawn by the node's view instead of spreading the handles evenly over the node's height (#92). -
Binary file drops: binary files dropped onto the canvas, such as images or Parquet, now arrive with
bytescontent instead of being mangled by a text decode. Any file that decodes as UTF-8 still arrives as astr, whatever MIME type the operating system reports, so text handlers keep working (#88). -
Drop size limit: the new
max_drop_sizeparameter (10 MB by default,0disables it) caps the bytes sent for one drop so a large drop cannot exceed the websocket message limit and disconnect the session. Files over the limit or that cannot be read are listed in the drop event'srejectedentries instead of discarding the whole drop (#88). -
Selecting nodes from Python: a node's
selectedfield set from Python now selects it in the browser, and Python updates sent while a node is being dragged no longer snap it back to its old position (#88).
Behavior changes¶
-
With
editable=False, editors are hidden everywhere (side panel, node toolbar and inline), per-nodedraggable,connectableanddeletableflags are forced off in the browser, and the Delete key does nothing. PreviouslyNodeSpecnodes could still be dragged and node data edited through the toolbar in a read-only graph (#81, #85). -
The interactivity (lock) button is removed from the canvas controls, since it could re-enable dragging regardless of
editable(#85). -
In read-only graphs, dict nodes without a
draggablekey now receive pointer events, so their embedded widgets, context menu and handle clicks work (#83). -
remove_node()also removes the nodes nested in a removed node throughparentId, as deleting a parent in the browser already did (#95). -
Selection changes made in the browser no longer emit
node_props_changed/edge_props_changedforNode/Edgeinstances (nor echo apatch_*_propsmessage back to the browser);selection_changedandon_selection_changedstill fire (#89). -
Cached editors are rebuilt when a node is replaced under the same id, its type changes or the type/editor configuration changes (#89).
Bug fixes¶
-
Node clicks:
node_clickedevents andNode.on_clickhooks were documented but never sent by the frontend. Clicks are now reported with a screenpositionthat can be passed toshow_popup(), except for clicks on a node's embedded view or editor and clicks that end a drag (#83). -
Lost messages in debounce mode: with
sync_mode="debounce"only the last pending message was sent, so deleting a multi-node selection never reached Python and dragging several nodes reported only one move. Messages are now queued and sent in order (#88). -
Malformed nodes: a
nullor non-object node no longer blanks the whole component; the error boundary catches it and safe mode drops it (#88). -
Patches lost to a nodes sync: a
patch_node_props()orpatch_node_data()sent while an older nodes sync is still on its way to the browser is no longer undone by that sync, and one for a node that reaches the browser in the same update is applied once the node arrives instead of being dropped. For example, selecting the new group right aftergroup_nodes()in an event callback now works (#96, #97). -
Late views: a node's embedded view that reaches the browser after the node itself is now shown instead of leaving the node empty (#93).
-
Edges detached from moved handles: a handle whose
topreads a CSS variable set through the node'sstyleorclassNamemoves when that changes, but its edges stayed at the old position because React Flow only re-measures handles when a node resizes. Nodes now re-measure their handles when theirstyle,className,data.inputsordata.outputschanges, batched into one update per frame (#99, #100). -
Selection on re-mount: mounting a view again, for example when a dynamic tab hides and shows the canvas, no longer clears the selection in Python (#101).
-
Schema editors: forms are built for the schemas generated by
paramandpydantic($ref, nullableanyOf,const, enums,minimum/maximum), a property without a dedicated widget is shown as a literal input instead of replacing the whole form, and nullable fields show and acceptNone. Building an editor no longer switches the globalpn.config.designtoMaterialDesign; importpanel_material_uifirst, or setpn.config.design, if your app relies on that.jsonschemais now a dependency, so node and edge data is always validated against its schema, andpanel-material-uiis declared through thematerialextra (#87). -
Editor refresh: the side panel refreshes when node or edge editors are rebuilt while something is selected, changing an edge's type re-resolves its editor, and toggling
editableat runtime re-renders nodes with embedded views (#81). -
Connection validation: validation requests always get a reply, so a malformed request no longer rejects every handle after a timeout. Validators and event callbacks with extra optional parameters are called with the right arguments, a single handle string in
inputs/outputsis no longer split into one handle per character, and unconnectable nodes and handles are skipped. In the browser, connection policies are computed once per graph snapshot instead of for every handle during a drag (#90). -
from_networkxid collisions: a graph whose node ids collide once stringified (1and"1") raises aValueErrorinstead of silently merging the nodes, and parallel edges in a multigraph get unique edge ids (#90).
Version 0.5.1¶
A small enhancement release that lets the canvas accept files dragged in from the operating system.
Enhancements¶
- Drop files onto the canvas: add
"Files"todrop_typesto accept files dragged in from the operating system. Thedropevent'sdatalists each file'sname,type,sizeand textcontent, so a handler can, for example, load a graph saved as JSON. See React to Events (#79).
Version 0.5.0¶
This release adds port and edge value inspection, connection checks and canvas drops for interactive graph editing. Node and Edge properties now sync to the browser in place, batches of changes render as a single update, and an error boundary keeps a malformed graph from blanking the canvas.
Highlights¶
-
Port and edge inspection: handle and edge click events can open a Panel popup with
flow.show_popup(content, position). Setpopup_trigger="hover"to use hover events instead; useflow.close_popup()to dismiss it. Applications supply the value to display, andexamples/port_value_inspection.pyshows both interactions (#74). -
Connection validation: opt-in browser policies reject connections with the wrong direction or handle type, full inputs, duplicate edges, and cycles. Register Python rules with
add_connection_validator()to show rejection reasons on candidate handles during a drag. Python validators check interactive drags only; they do not restrictflow.add_edge()or direct changes toflow.edges. See Validate Connections andexamples/connection_validation.py(#75). -
Error recovery: the canvas is now wrapped in an error boundary, controlled by the new
error_recoveryparameter ("auto"by default, or"manual"/"off"). In"auto"mode a React render error remounts the canvas, then remounts again in a view-only safe mode that repairs or hides elements it cannot render (invalid positions, unknown node/edge types, dangling edges, duplicate or missing ids) without mutating the server-side graph. If retries are exhausted a recovery panel offers Try again, Reload page and Copy details. Every error is logged to thepanel.reactflowlogger and emitted as aclient_errorevent, so browser-side failures are no longer invisible to the server (#70). -
Base property sync: the top-level React Flow fields on
NodeandEdge(label,type,style,className,draggable,connectable,deletable, ...) are now synced to the frontend, so assigningnode.label = "Start (running)"patches the browser in place instead of requiringflow.nodesto be replaced. Parameters declared on a subclass continue to sync intodata. Newpatch_node_props()andpatch_edge_props()methods do the same for dict-based nodes and edges, where passingNoneclears a field back to the CSS/theme default, and newon_props_changehooks fire onNode/Edgesubclasses when the frontend changes a property.positionandselectedremain browser-owned during drag and selection and are only pushed viapatch_node_props()(#71).
Enhancements¶
-
Batch removal:
remove_node()andremove_edge()now accept several ids, either as separate arguments (flow.remove_node("n1", "n2")) or as a sequence (flow.remove_node(["n1", "n2"])), and remove them in a single update. For any other batch of changes made from Python, wrap them inpn.io.hold()to render them at once (#72). -
Drop data onto the canvas:
drop_typeslists MIME types the canvas accepts, and each drop of one of them emits adropevent with the dropped data, its flow position, and the node or handle under the pointer, so a handler can add and wire what was dropped. Draggablepanel_material_ui.MenuListitems work as a source; see React to Events (#77).
Bug fixes¶
-
Nodes remounted when node types change: any change to
node_typesrebuilt the component for every node type, so React remounted every node and detached its embedded view, which could leave Bokeh plots blank. Each type's component is now reused until its own spec or the popup settings change (#77). -
Progressive re-render when deleting multiple elements: deleting a multi-node selection removed the nodes one at a time, syncing an intermediate graph to the browser per node so the nodes visibly disappeared one by one. Updates triggered by a frontend message are now held and combined into a single patch, and node/edge deletion assigns
nodesandedgesonce (#72). -
Serialization error when updating
node_types: assigningNodeTypeorEdgeTypedescriptors with aschemaclass after construction synced them to the browser before they were converted to JSON descriptors, so the server failed withcan't serialize ParameterizedMetaclass. They are now converted before syncing, and updatingnode_typesandedge_typestogether no longer raises aTypeError(#76).
Version 0.4.1¶
A small enhancement release adding viewport zoom controls.
Enhancements¶
- Zoom limits — new
min_zoom(default0.5) andmax_zoom(default2) parameters constrain how far the canvas can be zoomed out and in, and can be updated at runtime (#69).
Version 0.4.0¶
This release adds new interaction features, edge routing options, and handle customization capabilities.
Highlights¶
- Right-click context menu — nodes and the canvas now support a configurable context menu triggered on right-click, enabling custom actions like delete, duplicate, or copy without toolbar buttons (#65).
- Smart edge routing — new smart edge types (
smartBezier,smartStep,smartStraight) that automatically route around nodes instead of passing through them (#64). - Handle connectivity controls — per-type flags (
input_connectable,input_connectable_start,input_connectable_end, and theiroutput_*counterparts) let you restrict which handles users can drag edges from or to (#63). - Handle tooltips — handles can now carry a
labelthat appears as an instant tooltip on hover, making port purpose discoverable without cluttering the canvas. Pass{"id": "port_name", "label": "Description"}in yourinputs/outputslists (#67). Node.flowandEdge.flowback-references — instance-based nodes and edges now hold a.flowreference to their parentReactFlow, simplifying imperative graph manipulation from callbacks (#56).- Delete key support — selected nodes and edges can now be removed with the Delete key, matching standard graph-editor UX expectations.
- Bundle cache-busting — the frontend bundle URL now includes a content hash, preventing stale cached bundles after upgrades (#68).
Bug fixes¶
- Fixed stale node views not updating and deletion causing flicker (#60).
- Fixed
flowattribute initialization on component creation (#59). - Edge/node add/remove events are now emitted exactly once (#58).
- Fixed removing a node when edges are defined as
Edgeinstances (#57).
Version 0.3.0¶
This release focuses on core graph-model capabilities, callback ergonomics, rendering/styling improvements, and major documentation expansion.
Highlights¶
- Parameterized
Node/Edgeinstances as first-class graph elements —ReactFlownow supports instance-based graph authoring with richer Python object workflows, including improved serialization/sync behavior and expanded API/core test coverage. - Event callback improvements —
.on(...)callbacks can now accept theReactFlowinstance as a second argument and support async callbacks, making app-level event handling significantly more flexible. - Rendering fixes for embedded views — improved scaling and interaction behavior when rendering figures inside nodes, including better handling of drag/pan/scroll conflicts within embedded content.
- Editor rendering robustness — fixed node and edge editor rendering paths so editors can render reliably even when no node
viewis defined. - Color mode and default node styling support — added color-mode-aware styling capabilities and refined baseline node CSS for better defaults out of the box.
- Expanded how-to documentation — substantial updates to guides for declaring types, defining nodes/edges, editors, embedding views, reacting to events, and styling, with refreshed screenshots across the docs.
- Examples overhaul in docs — added an examples gallery with grid cards and dedicated pages/screenshots for each example app, plus docs navigation updates for easier discovery.
Version 0.2.0¶
This release focuses on stronger typed graph specs, better node-view handling, and improved docs and packaging.
Highlights¶
NodeSpecview support — added aviewparameter toNodeSpecand fixedadd_nodebehavior so embedded views are preserved when adding nodes programmatically.- Safer embedded view handling — fixed an
AttributeErrorwhen node views are PanelViewerobjects or other arbitrary view-like objects. EdgeSpechandle targeting — addedsourceHandleandtargetHandlefields to support explicit edge-to-port connections.- Spec auto-serialization — added automatic serialization for
NodeSpecandEdgeSpecobjects to reduce boilerplate when using dataclass-based graph definitions. - Handle rendering fix — corrected empty handle list behavior so
[]is treated distinctly from missing/undefined handles. - Styling hook for labels — added the
rf-node-labelCSS class on node labels for easier targeted styling. - Docs and onboarding updates — quickstart and index docs now explicitly document the required
pn.extension("jsoneditor")setup; additional how-to docs were updated for new handle and serialization behavior. - Packaging reliability — ensured the frontend
distassets are included in distributions.
Version 0.1.0¶
Initial release
Panel-ReactFlow brings the power of React Flow to the Panel ecosystem, giving Python developers a fully interactive node-based graph editor with minimal boilerplate.
Highlights¶
- ReactFlow component — a Panel component that renders an interactive React Flow canvas with drag, select, connect, and delete support.
- Python-first graph state — define nodes and edges as plain Python dictionaries; all changes sync bidirectionally between the frontend and Python.
- Node & edge types — use
NodeTypeandEdgeTypedataclasses to declare typed nodes and edges with optional JSON Schema for theirdatapayloads. - Schema-driven editors — auto-generate editing forms from JSON Schema (via
SchemaEditor) or fall back to a raw JSON tree view (JsonEditor). Custom editors can be any Python callable or class. - Editor display modes — show editors inline inside nodes (
editor_mode="node"), in a toolbar popover ("toolbar"), or in a side panel ("side"). - Embedded views — pass any Panel
Viewableas a node'sviewto render rich content (charts, indicators, widgets) directly inside graph nodes. - Event system — subscribe to granular events (
node_added,edge_deleted,selection_changed, …) or use"*"to listen to everything. - Custom handles — configure named input and output ports per node type.
- Stylesheets — apply CSS stylesheets targeting
.react-flow__node-{type}and.react-flow__edge-{type}classes for full visual control. - Panel integration —
top_panel,bottom_panel,left_panel, andright_panelslots for surrounding the canvas with arbitrary Panel components. - Helper dataclasses —
NodeSpecandEdgeSpecfor validated node/edge construction; convenience methodsadd_node,remove_node,add_edge,remove_edge, andpatch_node_data/patch_edge_datafor live graph manipulation.