You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/guide/controlled-flow.md
+73-6Lines changed: 73 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,16 +4,83 @@ title: Controlled Flow
4
4
5
5
# Taking Control of Vue Flow
6
6
7
-
Vue Flow is designed to be flexible and customizable, allowing you to take control of the flow of your application.
8
-
By default, Vue Flow will apply changes automatically, so you don't have to worry about it.
9
-
10
7
::: warning
11
-
This API is subject to change in the next major release where changes will *most likely*not be applied automatically anymore.
8
+
This API is subject to change in the next major release where changes will not be applied automatically anymore.
12
9
:::
13
10
11
+
By default, Vue Flow will apply *changes* automatically, so you don't have to worry about it.
12
+
14
13
Though, there are cases where you want to take control of changes and apply them manually after some processing and validations for example.
15
14
16
-
This guide will show you how to take control of Vue Flow and apply these changes manually.
15
+
In this guide, we will learn how to take control of changes and apply them manually.
16
+
17
+
## What is a [Change](https://vueflow.dev/typedocs/types/NodeChange.html)?
18
+
19
+
A *change* is anything that is triggered by an interaction with the flow, like adding, updating (position, selected), or removing a node or an edge, either
20
+
by dragging, clicking etc. or by using the provided API.
21
+
22
+
These changes are communicated to the user-land through the `onNodesChange` and `onEdgesChange` events.
23
+
24
+
Possible Changes include:
25
+
26
+
-[`add`](https://vueflow.dev/typedocs/interfaces/NodeAddChange.html): A node or an edge was added.
27
+
-[`remove`](https://vueflow.dev/typedocs/interfaces/NodeRemoveChange.html): A node or an edge was removed.
28
+
-[`select`](https://vueflow.dev/typedocs/interfaces/NodeSelectionChange.html): A node or an edge was selected/unselected.
29
+
-[`position`](https://vueflow.dev/typedocs/interfaces/NodePositionChange.html): A nodes' position was updated.
30
+
-[`dimensions`](https://vueflow.dev/typedocs/interfaces/NodeDimensionChange.html): A nodes' dimensions were updated.
31
+
32
+
::: warning
33
+
Changes *do not* refer to *any* change in the flow, like zooming or panning, or just updating the `data` object of a node.
34
+
:::
35
+
36
+
### Why is no change emitted when I update a node?
37
+
38
+
Vue Flow will not track your nodes/edges and try to figure out what changed, it will only emit changes when you interact with the flow or use the API.
0 commit comments