Skip to content

Commit 4091d8c

Browse files
committed
chore(website): add navigationKind optional arg to onSettled hook callback
1 parent cd05f83 commit 4091d8c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

website/docs/define-actions/action-utils.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This property can be set either to a boolean value, or to an object that contain
2020
- `onSuccess()`: called when action execution succeeds.
2121
- `onError()`: called when action execution fails (validation errors or server error).
2222
- `onNavigation()`: called when a `next/navigation` function is called in a middleware function or in the action's server code function.
23-
- `onSettled()`: called when action execution succeeds or fails.
23+
- `onSettled()`: called when action execution succeeds, fails or navigates.
2424

2525
With action callbacks you can perform custom logic after the action is executed, on the server side. You can pass them to [`action()`/`stateAction()`](/docs/define-actions/instance-methods#action--stateaction) method as the second argument, after the server code function. Their return value is not used and they **must** be async functions.
2626

website/docs/execute-actions/hooks/hook-callbacks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ description: Hook callbacks are a way to perform custom logic based on the curre
99
- `onSuccess`: called when `status` is `"hasSucceeded"`.
1010
- `onError`: called when `status` is `"hasErrored"`.
1111
- `onNavigation`: called when `status` is `"hasNavigated"`.
12-
- `onSettled`: called when `status` is either `"hasSucceeded"` or `"hasErrored"`.
12+
- `onSettled`: called when `status` is either `"hasSucceeded"`, `"hasErrored"` or `"hasNavigated"`.
1313

1414
Hook callbacks are a way to perform custom logic based on the current action execution status. You can pass them to the three hooks in the `utils` object, which is the second argument. All of them are optional and don't return anything, they can also be async or not:
1515

@@ -19,6 +19,6 @@ const action = useAction(testAction, {
1919
onSuccess: ({ data, input }) => {},
2020
onError: ({ error, input }) => {},
2121
onNavigation: ({ input, navigationKind }) => {},
22-
onSettled: ({ result, input }) => {},
22+
onSettled: ({ result, input, navigationKind }) => {},
2323
});
2424
```

0 commit comments

Comments
 (0)