From 1ccd2275c820906ca155e4ce7b854fdddb6c74c8 Mon Sep 17 00:00:00 2001 From: Edmund Hung Date: Tue, 4 Jun 2024 20:19:51 +0200 Subject: [PATCH] docs: fix typo (#667) --- docs/integration/remix.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/integration/remix.md b/docs/integration/remix.md index fa6aa6dd..9a6d638a 100644 --- a/docs/integration/remix.md +++ b/docs/integration/remix.md @@ -88,7 +88,7 @@ export default function Login() { ### The default value might be out of sync if you reset the form from the action -If the default value of the form comes from the loader and you are trying to reset the form on the action, there is a chance you will see the form reset to the previous default value. This is Conform will reset the form the moment actionData is updated while Remix is still revalidating the loader data. To fix this, you can wait for the state to be `idle` (e.g. `navigation.state` or `fetcher.state`) before passing the `lastResult` to Conform like this: +If the default value of the form comes from the loader and you are trying to reset the form on the action, there is a chance you will see the form reset to the previous default value. As Conform will reset the form the moment action data is updated while Remix is still revalidating the loader data. To fix this, you can wait for the state to be `idle` (e.g. `navigation.state` or `fetcher.state`) before passing the `lastResult` to Conform like this: ```tsx export default function Example() { @@ -102,6 +102,9 @@ export default function Example() { // Sync the result of last submission only when the state is idle lastResult: navigation.state === 'idle' ? lastResult : null, + // or, if you are using a fetcher: + // lastResult: fetcher.state === 'idle' ? lastResult : null, + // ... });