Skip to content

Commit

Permalink
docs: add note about fetcher.load revalidation (#9582)
Browse files Browse the repository at this point in the history
  • Loading branch information
brookslybrand committed Jun 6, 2024
1 parent 4adbb05 commit c3efad3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/hooks/use-fetcher.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ fetcher.load("/some/route");
fetcher.load("/some/route?foo=bar");
```

`fetcher.load`'s revalidate by default after action submissions and explicit revalidation requests via [`useRevalidator`][userevalidator]. Because `fetcher.load` loads a specific URL they don't revalidate on changes to route param or URL search param. You can use [`shouldRevalidate`][shouldrevalidate] to optimize which data should be reloaded.

#### `options.unstable_flushSync`

The `unstable_flushSync` option tells React Router DOM to wrap the initial state update for this `fetcher.load` in a [`ReactDOM.flushSync`][flush-sync] call instead of the default [`React.startTransition`][start-transition]. This allows you to perform synchronous DOM actions immediately after the update is flushed to the DOM.
Expand Down Expand Up @@ -176,3 +178,5 @@ The form method of the submission.
[flush-sync]: https://react.dev/reference/react-dom/flushSync
[start-transition]: https://react.dev/reference/react/startTransition
[use-submit]: ./use-submit
[userevalidator]: ./use-revalidator
[shouldrevalidate]: ../route/should-revalidate#shouldrevalidate

0 comments on commit c3efad3

Please sign in to comment.