You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
35
35
36
36
<docs-warning>This feature only works if using a data router, see [Picking a Router][pickingarouter]</docs-warning>
37
37
@@ -41,12 +41,17 @@ There are several instances where data is revalidated, keeping your UI in sync w
41
41
- After an [`action`][action] is called from a [`<fetcher.Form>`][fetcher]
42
42
- After an [`action`][action] is called from [`useSubmit`][usesubmit]
43
43
- After an [`action`][action] is called from a [`fetcher.submit`][fetcher]
44
+
- When an explicit revalidation is triggered via [`useRevalidator`][userevalidator]
44
45
- When the [URL params][params] change for an already rendered route
45
46
- When the URL Search params change
46
47
- When navigating to the same URL as the current URL
47
48
48
49
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.
49
50
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
+
50
55
```jsx lines=[5-9,14-15,21-22]
51
56
<Route
52
57
path="meals-plans"
@@ -84,6 +89,6 @@ Note that this is only for data that has already been loaded, is currently rende
0 commit comments