From a3b34bcde57a1350771306962deeb2ef69a8e304 Mon Sep 17 00:00:00 2001 From: "svelte-docs-bot[bot]" <196124396+svelte-docs-bot[bot]@users.noreply.github.com> Date: Wed, 27 Aug 2025 12:30:31 +0000 Subject: [PATCH] sync kit docs --- .../20-core-concepts/60-remote-functions.md | 29 +++++++++++++++++-- .../docs/kit/98-reference/10-@sveltejs-kit.md | 6 ++++ 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/apps/svelte.dev/content/docs/kit/20-core-concepts/60-remote-functions.md b/apps/svelte.dev/content/docs/kit/20-core-concepts/60-remote-functions.md index 072e3270db..e4d5e12e6e 100644 --- a/apps/svelte.dev/content/docs/kit/20-core-concepts/60-remote-functions.md +++ b/apps/svelte.dev/content/docs/kit/20-core-concepts/60-remote-functions.md @@ -161,9 +161,9 @@ export const getPost = query(v.string(), async (slug) => { Both the argument and the return value are serialized with [devalue](https://github.com/sveltejs/devalue), which handles types like `Date` and `Map` (and custom types defined in your [transport hook](hooks#Universal-hooks-transport)) in addition to JSON. -### Refreshing queries +### Updating queries -Any query can be updated via its `refresh` method: +Any query can be re-fetched via its `refresh` method, which retrieves the latest value from the server: ```svelte ``` -> [!NOTE] Queries are cached while they're on the page, meaning `getPosts() === getPosts()`. This means you don't need a reference like `const posts = getPosts()` in order to refresh the query. +Alternatively, if you need to update its value manually, you can use the `set` method: + +```svelte + +``` + +> [!NOTE] Queries are cached while they're on the page, meaning `getPosts() === getPosts()`. This means you don't need a reference like `const posts = getPosts()` in order to update the query. ## form diff --git a/apps/svelte.dev/content/docs/kit/98-reference/10-@sveltejs-kit.md b/apps/svelte.dev/content/docs/kit/98-reference/10-@sveltejs-kit.md index 557e08020f..59049da645 100644 --- a/apps/svelte.dev/content/docs/kit/98-reference/10-@sveltejs-kit.md +++ b/apps/svelte.dev/content/docs/kit/98-reference/10-@sveltejs-kit.md @@ -2191,6 +2191,12 @@ type RemotePrerenderFunction = ( ```dts type RemoteQuery = RemoteResource & { + /** + * On the client, this function will update the value of the query without re-fetching it. + * + * On the server, this throws an error. + */ + set(value: T): void; /** * On the client, this function will re-fetch the query from the server. *