Skip to content

Commit a23f017

Browse files
committed
docs: Clarify fetcher load revalidation behavior
1 parent 2041d9c commit a23f017

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

docs/route/should-revalidate.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ interface ShouldRevalidateFunctionArgs {
3131

3232
</details>
3333

34-
This function allows you opt-out of revalidation for a route's loader as an optimization.
34+
This function allows you opt-out of revalidation for a route's [loader][loader] as an optimization.
3535

3636
<docs-warning>This feature only works if using a data router, see [Picking a Router][pickingarouter]</docs-warning>
3737

@@ -41,12 +41,17 @@ There are several instances where data is revalidated, keeping your UI in sync w
4141
- After an [`action`][action] is called from a [`<fetcher.Form>`][fetcher]
4242
- After an [`action`][action] is called from [`useSubmit`][usesubmit]
4343
- After an [`action`][action] is called from a [`fetcher.submit`][fetcher]
44+
- When an explicit revalidation is triggered via [`useRevalidator`][userevalidator]
4445
- When the [URL params][params] change for an already rendered route
4546
- When the URL Search params change
4647
- When navigating to the same URL as the current URL
4748

4849
If you define `shouldRevalidate` on a route, it will first check the function before calling the route loader for new data. If the function returns `false`, then the loader _will not_ be called and the existing data for that loader will persist on the page.
4950

51+
<docs-info>
52+
Fetcher loads also revalidate, but because they load a specific URL, they don't have to worry about the URL-driven revalidation scenarios above. Fetcher loads only revalidate by default after action submissions and explicit revalidation requests.
53+
</docs-info>
54+
5055
```jsx lines=[5-9,14-15,21-22]
5156
<Route
5257
path="meals-plans"
@@ -84,6 +89,6 @@ Note that this is only for data that has already been loaded, is currently rende
8489
[fetcher]: ../hooks/use-fetcher
8590
[usesubmit]: ../hooks/use-submit
8691
[loader]: ./loader
87-
[useloaderdata]: ../hooks/use-loader-data
8892
[params]: ./route#dynamic-segments
8993
[pickingarouter]: ../routers/picking-a-router
94+
[userevalidator]: ../hooks/use-revalidator

0 commit comments

Comments
 (0)