@@ -5,6 +5,32 @@ new: true
5
5
6
6
# ` shouldRevalidate `
7
7
8
+ <details >
9
+ <summary >Type declaration</summary >
10
+
11
+ ``` ts
12
+ interface ShouldRevalidateFunction {
13
+ (args : ShouldRevalidateFunctionArgs ): boolean ;
14
+ }
15
+
16
+ interface ShouldRevalidateFunctionArgs {
17
+ currentUrl: URL ;
18
+ currentParams: AgnosticDataRouteMatch [" params" ];
19
+ nextUrl: URL ;
20
+ nextParams: AgnosticDataRouteMatch [" params" ];
21
+ formMethod? : Submission [" formMethod" ];
22
+ formAction? : Submission [" formAction" ];
23
+ formEncType? : Submission [" formEncType" ];
24
+ text? : Submission [" text" ];
25
+ formData? : Submission [" formData" ];
26
+ json? : Submission [" json" ];
27
+ actionResult? : any ;
28
+ defaultShouldRevalidate: boolean ;
29
+ }
30
+ ```
31
+
32
+ </details >
33
+
8
34
This function allows you opt-out of revalidation for a route's loader as an optimization.
9
35
10
36
<docs-warning >This feature only works if using a data router, see [ Picking a Router] [ pickingarouter ] </docs-warning >
@@ -53,27 +79,6 @@ Note that this is only for data that has already been loaded, is currently rende
53
79
54
80
<docs-warning >Using this API risks your UI getting out of sync with your data, use with caution!</docs-warning >
55
81
56
- ## Type Declaration
57
-
58
- ``` ts
59
- interface ShouldRevalidateFunction {
60
- (args : {
61
- currentUrl: URL ;
62
- currentParams: AgnosticDataRouteMatch [" params" ];
63
- nextUrl: URL ;
64
- nextParams: AgnosticDataRouteMatch [" params" ];
65
- formMethod? : Submission [" formMethod" ];
66
- formAction? : Submission [" formAction" ];
67
- formEncType? : Submission [" formEncType" ];
68
- formData? : Submission [" formData" ];
69
- json? : Submission [" json" ];
70
- text? : Submission [" text" ];
71
- actionResult? : DataResult ;
72
- defaultShouldRevalidate: boolean ;
73
- }): boolean ;
74
- }
75
- ```
76
-
77
82
[ action ] : ./action
78
83
[ form ] : ../components/form
79
84
[ fetcher ] : ../hooks/use-fetcher
0 commit comments