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
A meta chain is a singly linked list composed of [meta chain nodes](/docs/types/MetaChainNode.md). The last node in the chain must be a normal [action object](/docs/types/Action.md). All other nodes in the chain (if any) must be [meta nodes](/docs/types/MetaNode.md).
30
30
31
-
A meta node is very similar to a normal action object. It's an object with required `metaType` and `action` properties and an optional `metaPayload` property:
31
+
A meta node is very similar to a normal action object. It's an object with required `metaType` and `action` properties and an optional `metaData` property:
32
32
33
33
```typescript
34
34
interfaceMetaNode {
35
35
metaType:string,
36
-
metaPayload?:any,
37
-
action:MetaChainNode
36
+
metaData?:any,
37
+
payload:MetaChainNode
38
38
}
39
39
```
40
40
41
-
A meta node's `action` property holds the next link in the chain.
41
+
A meta node's `payload` property holds the next link in the chain.
Copy file name to clipboardExpand all lines: docs/types/Action.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Action
2
2
3
-
An action is a plain object containing a `type` property and optional `payload` property. While this interface can be extended, actions should never contain `metaType`, `metaPayload`, or `action` properties, as these are reserved for [meta nodes](/docs/types/MetaNode.md).
3
+
An action is a plain object containing a `type` property and optional `payload` property. While `type` is required, `payload` is optional and can be replaced with whatever standard you wish.
**type** - Some string that identifies this action. Avoid using names starting with `'@@zedux/'` as these are reserved for internal Zedux action types.
15
+
**payload** - optional - Literally anything. Just a standard.
A meta node is a node in a meta chain that defines meta data for the action it wraps. There are a few [built-in meta types](/docs/api/metaTypes.md), but you can use custom types as well.
3
+
A meta node wraps an action in meta data. It is a node in a meta chain. There are a few [built-in meta types](/docs/api/metaTypes.md), but you can use custom types as well.
4
4
5
5
## Definition
6
6
7
-
```typescript
7
+
```ts
8
8
interfaceMetaNode {
9
9
metaType:string,
10
-
metaPayload?:any,
11
-
action:MetaChainNode
10
+
metaData?:any,
11
+
payload:MetaChainNode
12
12
}
13
13
```
14
14
15
15
**metaType** - Some string that identifies this meta node. Analogous to the `type` property of [actions](/docs/types/Action.md). Avoid using names starting with `'@@zedux/'` as these are reserved for internal Zedux meta types.
16
16
17
-
**metaPayload** - Optional - Can be literally anything.
17
+
**metaData** - Optional - Can be literally anything.
18
18
19
-
**action** - The next node in the chain. So named because the last node in the chain must be an [action](/docs/types/Action.md) object. All meta nodes therefore effectively "wrap" the action in meta data.
19
+
**payload** - The next node in the chain. The last meta node in the chain must specify the wrapped action as its `payload` property.
20
20
21
21
## Notes
22
+
23
+
Zedux uses meta nodes internally to handle the intricacies of store composition. But you can use them too. A good use case is to add extra debugging information to dispatched actions:
0 commit comments