Skip to content

Commit 4e01865

Browse files
committed
chore(website): update docs for new status logic
1 parent 9a2d24b commit 4e01865

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

website/docs/execute-actions/hooks/useaction.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,9 @@ As you can see, here we display a greet message after the action is performed, i
7777
- `isIdle`: true if the action status is `idle`.
7878
- `isTransitioning`: true if the transition status from the `useTransition` hook used under the hood is `true`.
7979
- `isExecuting`: true if the action status is `executing`.
80-
- `isPending`: same as `isExecuting` (deprecated).
80+
- `isPending`: true if the action status is `executing` or `transitioning`.
8181
- `hasSucceeded`: true if the action status is `hasSucceeded`.
8282
- `hasErrored`: true if the action status is `hasErrored`.
8383
- `hasNavigated`: true if a `next/navigation` function was called inside the action.
8484

85-
The `executing` status and `isExecuting` shorthand property include the transition state.
86-
8785
Explore a working example [here](<https://github.com/TheEdoRan/next-safe-action/tree/main/apps/playground/src/app/(examples)/hook>).

website/docs/execute-actions/hooks/useoptimisticaction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export default function TodosBox({ todos }: Props) {
131131
- `isIdle`: true if the action status is `idle`.
132132
- `isTransitioning`: true if the transition status from the `useTransition` hook used under the hood is `true`.
133133
- `isExecuting`: true if the action status is `executing`.
134-
- `isPending`: same as `isExecuting` (deprecated).
134+
- `isPending`: true if the action status is `executing` or `transitioning`.
135135
- `hasSucceeded`: true if the action status is `hasSucceeded`.
136136
- `hasErrored`: true if the action status is `hasErrored`.
137137
- `hasNavigated`: true if a `next/navigation` function was called inside the action.

website/docs/migrations/v7-to-v8.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ const result = await boundAction(input);
9292

9393
The deprecated `executeOnMount` hook functionality has been removed in v8. Server Actions should be used only for mutations, so it doesn't make sense to execute them on mount. Or at least, it shouldn't be a common case and, above all, a library job. If you still need to do it, just use `useEffect()` to trigger the execution, however you want.
9494

95-
### 🔄 Deprecation of `isPending` shorthand status property
96-
97-
The `isPending` shorthand status property is now deprecated, and will be removed in a future version. Having both `isExecuting` and `isPending` properties is a bit confusing, so now both the `isExecuting` property and `"executing"` status value include the transition state of the action execution. `isPending` right now is just an alias for `isExecuting`.
98-
9995
### ✨ Type-checked metadata
10096

10197
This is a big improvement in type safety over v7. Metadata is now statically type-checked when passed to actions. So, now if you forget to pass the expected metadata shape, as defined by the `defineMetadataSchema` init option, you will get a type error immediately:
@@ -131,6 +127,10 @@ const action = actionClient
131127
);
132128
```
133129

130+
### ✨ Added `transitioning` status
131+
132+
The `transitioning` status has been added to the hook result object. This status is set when the action has finished executing, but the transition is not yet complete. The transition state is handled by the [`useTransition()`](https://react.dev/reference/react/useTransition) React hook used under the hood in next-safe-action hooks.
133+
134134
### 🔄 Safe action result always defined
135135

136136
The action result object is now always defined. This allows you to destructure it without the need to check if it's defined or not first:

0 commit comments

Comments
 (0)