Skip to content

Commit 52891f2

Browse files
committed
add section about using revalidate together with redirect
1 parent 579abed commit 52891f2

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

  • src/routes/solid-router/reference/response-helpers

src/routes/solid-router/reference/response-helpers/redirect.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,13 @@ function redirect(url: string, init?: number | RouterResponseInit): CustomRespon
7272
```
7373

7474
The `RouterResponseInit` type extends the native [`ResponseInit`](https://developer.mozilla.org/en-US/docs/Web/API/Response/Response#options) interface.
75+
76+
## Revalidate Query Keys
77+
78+
You can pass query keys to the redirect helper to revalidate them.
79+
80+
```ts
81+
redirect("/", { revalidate: ["getUser", getUser.keyFor(id)] });
82+
```
83+
84+
This will only invalidate the query keys passed to the redirect helper instead of the entire next page.

0 commit comments

Comments
 (0)