Skip to content

Commit 1ad29bf

Browse files
Replace the deprecated cache with query (#1075)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent 87122a4 commit 1ad29bf

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

src/routes/guides/routing-and-navigation.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ This means you can initialize the page, or use [Data APIs](/solid-router/referen
493493

494494
<Callout>
495495
To prevent a fetch from happening more than once, or to trigger a refetch, you
496-
can use the [`cache` function](/solid-router/reference/data-apis/cache).
496+
can use the [`query` function](/solid-router/reference/data-apis/query).
497497
</Callout>
498498

499499
```jsx title="index.jsx"

src/routes/solid-router/reference/data-apis/create-async.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ An asynchronous primitive with a function that tracks similar to `createMemo`.
77
Reading it before it is ready causes Suspense/Transitions to trigger.
88

99
<Callout type="caution">
10-
Using `cache` in `createResource` directly will not work since the fetcher is
10+
Using `query` in `createResource` directly will not work since the fetcher is
1111
not reactive. This means that it will not invalidate properly.
1212
</Callout>
1313

src/routes/solid-router/reference/data-apis/query.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ For instance, both `{ name: 'Ryan', awesome: true }` and `{ awesome: true, name:
8585

8686
## Return value
8787

88-
The return value is a `CachedFunction`, a function that has the same signature as the function you passed to `cache`.
88+
The return value is a `CachedFunction`, a function that has the same signature as the function you passed to `query`.
8989
This cached function stores the return value using the cache key.
9090
Under most circumstances, this temporarily prevents the passed function from running with the same arguments, even if the created function is called repeatedly.
9191

src/routes/solid-start/advanced/return-responses.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Returning responses
33
---
44

55
In SolidStart, it is possible to return a Response object from a server function.
6-
[`solid-router`](/solid-router) knows how to handle certain responses with its [`cache`](/solid-router/reference/data-apis/cache) and [`action`](/solid-router/reference/data-apis/action) APIs.
6+
[`solid-router`](/solid-router) knows how to handle certain responses with its [`query`](/solid-router/reference/data-apis/query) and [`action`](/solid-router/reference/data-apis/action) APIs.
77
For Typescript, when returning a response using `solid-router`'s `redirect`, `reload`, or `json` helpers, they will not impact the return value of the server function.
88

99
While we suggest depending on the type of the function to handle errors differently, you can always return or throw a response.

src/routes/solid-start/advanced/session.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export async function getUser(): Promise<User | null> {
4141

4242
This helper can be used wherever you want to authenticate the request, including in server functions and [API routes](/solid-start/building-your-application/api-routes).
4343

44-
Additionally, you can use it with [`cache`](/solid-router/reference/data-apis/cache) from `solid-router` to make sure that only authenticated users can access the data.
44+
Additionally, you can use it with [`query`](/solid-router/reference/data-apis/query) from `solid-router` to make sure that only authenticated users can access the data.
4545
That way if the user is not authenticated, the request will be redirected to the login page.
4646

4747
```tsx title="/routes/api/store/admin.ts"

0 commit comments

Comments
 (0)