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
Copy file name to clipboardExpand all lines: src/routes/solid-router/reference/data-apis/revalidate.mdx
+76-24Lines changed: 76 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,48 +10,100 @@ tags:
10
10
- invalidation
11
11
- polling
12
12
- refetch
13
-
version: '1.0'
13
+
version: "1.0"
14
14
description: >-
15
15
Manually revalidate cached queries to refresh stale data, implement polling,
16
16
or trigger updates after mutations in SolidJS.
17
17
---
18
18
19
-
The `revalidate` function is used to revalidate queries associated with specified [query keys](/solid-router/reference/data-apis/query#query-keys).
20
-
When a [query](/solid-router/reference/data-apis/query) is revalidated, it is executed again, and any references to the associated query data are updated accordingly.
19
+
The `revalidate` function triggers revalidation of [queries](/solid-router/data-fetching/queries) by their keys.
20
+
Each query with active subscribers re-executes and updates its dependents; queries without subscribers are marked stale but don't execute until subscribed.
21
+
22
+
## Import
23
+
24
+
```tsx
25
+
import { revalidate } from"@solidjs/router";
26
+
```
27
+
28
+
## Type
29
+
30
+
```tsx
31
+
function revalidate(
32
+
key?:string|string[] |void,
33
+
force?:boolean
34
+
):Promise<void>;
35
+
```
36
+
37
+
## Parameters
38
+
39
+
### `key`
40
+
41
+
-**Type:**`string | string[] | void`
42
+
-**Required:** No
43
+
44
+
The query key or array of query keys to revalidate.
45
+
If not provided, all queries on the current page are revalidated.
46
+
47
+
### `force`
48
+
49
+
-**Type:**`boolean`
50
+
-**Required:** No
51
+
-**Default:**`true`
52
+
53
+
When `true`, clears the internal cache used for deduplication.
54
+
When `false`, allows cached data to be reused if available.
55
+
56
+
## Return value
57
+
58
+
`revalidate` returns a `Promise` that resolves when the revalidation transition completes.
0 commit comments