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: apps/svelte.dev/content/docs/kit/20-core-concepts/60-remote-functions.md
+17-2Lines changed: 17 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -163,15 +163,15 @@ Both the argument and the return value are serialized with [devalue](https://git
163
163
164
164
### Refreshing queries
165
165
166
-
Any query can be updated via its `refresh` method:
166
+
Any query can be re-fetched via its `refresh` method, which retrieves the latest value from the server:
167
167
168
168
```svelte
169
169
<button onclick={() =>getPosts().refresh()}>
170
170
Check fornewposts
171
171
</button>
172
172
```
173
173
174
-
> [!NOTE] Queries are cached while they're on the page, meaning `getPosts() ===getPosts()`. This means you don't need a reference like `constposts=getPosts()` in order to refresh the query.
174
+
> [!NOTE] Queries are cached while they're on the page, meaning `getPosts() ===getPosts()`. This means you don't need a reference like `constposts=getPosts()` in order to update the query.
Copy file name to clipboardExpand all lines: apps/svelte.dev/content/docs/kit/98-reference/[email protected]
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2191,6 +2191,13 @@ type RemotePrerenderFunction<Input, Output> = (
2191
2191
2192
2192
```dts
2193
2193
type RemoteQuery<T> = RemoteResource<T> & {
2194
+
/**
2195
+
* On the client, this function will update the value of the query without re-fetching it.
2196
+
*
2197
+
* On the server, this can be called in the context of a `command` or `form` and the specified data will accompany the action response back to the client.
2198
+
* This prevents SvelteKit needing to refresh all queries on the page in a second server round-trip.
2199
+
*/
2200
+
set(value: T): void;
2194
2201
/**
2195
2202
* On the client, this function will re-fetch the query from the server.
0 commit comments