Skip to content

Commit 996c291

Browse files
committed
..
1 parent 1b303ff commit 996c291

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

docs/enterprise/react_flow/basic_flow.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,15 @@ class FlowState(rx.State):
7171
{"id": "e2-3", "source": "2", "target": "3"},
7272
]
7373

74+
75+
@rx.event
76+
def set_nodes(self, nodes: list[Node]):
77+
self.nodes = nodes
78+
7479
@rx.event
75-
def on_connect(self, connection: dict):
76-
self.edges = rxe.flow.util.add_edge(connection, self.edges)
80+
def set_edges(self, edges: list[Edge]):
81+
self.edges = edges
82+
7783

7884
def flow_example():
7985
return rx.box(

docs/enterprise/react_flow/interactivity.md

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,19 @@ Event handlers allow the flow to respond to user interactions such as dragging n
2828

2929
```python
3030
@rx.event
31-
def on_nodes_change(self, changes: list[dict]):
32-
self.nodes = rxe.flow.util.apply_node_changes(self.nodes, changes)
31+
def set_nodes(self, nodes: list[Node]):
32+
self.nodes = nodes
3333

3434
@rx.event
35-
def on_edges_change(self, changes: list[dict]):
36-
self.edges = rxe.flow.util.apply_edge_changes(self.edges, changes)
37-
38-
@rx.event
39-
def on_connect(self, connection: dict):
40-
self.edges = rxe.flow.util.add_edge(connection, self.edges)
35+
def set_edges(self, edges: list[Edge]):
36+
self.edges = edges
4137

4238
```
4339

44-
- on_nodes_change updates nodes when they are moved or edited.
40+
- set_nodes updates nodes when they are moved or edited.
4541

46-
- on_edges_change updates edges when they are modified or deleted.
42+
- set_edges updates edges when they are modified or deleted.
4743

48-
- on_connect allows users to create new edges by dragging between node handles.
4944

5045
## Render the Interactive Flow
5146

0 commit comments

Comments
 (0)