From 4a74df9affbe1c4e91342b8147646ae74dc14efd Mon Sep 17 00:00:00 2001 From: Edoardo Ranghieri Date: Tue, 3 Sep 2024 19:30:01 +0200 Subject: [PATCH] chore(website): better explain `optimisticState` behavior in `useOptimisticAction` hook page --- website/docs/execute-actions/hooks/useoptimisticaction.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/docs/execute-actions/hooks/useoptimisticaction.md b/website/docs/execute-actions/hooks/useoptimisticaction.md index e1c7095..d8eaee2 100644 --- a/website/docs/execute-actions/hooks/useoptimisticaction.md +++ b/website/docs/execute-actions/hooks/useoptimisticaction.md @@ -107,7 +107,7 @@ export default function TodosBox({ todos }: Props) { }}> Add todo - {/* Optimistic state gets updated immediately, it doesn't wait for the server to respond. */} + {/* Optimistic state gets updated right after the `execute` call (next render), it doesn't wait for the server to respond. */}
Optimistic state: {optimisticState}
); @@ -125,7 +125,7 @@ export default function TodosBox({ todos }: Props) { - `executeAsync`: an action caller that returns a promise with the return value of the safe action. Input is the same as the safe action you passed to the hook. - `input`: the input passed to the `execute` or `executeAsync` function. - `result`: result of the action after its execution. -- `optimisticState`: the optimistic state updated immediately after the action is executed, with the behavior defined in `updateFn`. +- `optimisticState`: the optimistic state updated right after `execute` call (on the next render), with the behavior defined in `updateFn`. - `reset`: programmatically reset execution state (`input`, `status` and `result`). - `status`: string that represents the current action status. - `isIdle`: true if the action status is `idle`.