Skip to content

Commit 90a2bab

Browse files
authored
Revert "Sync kit docs" (#1510)
Revert "Sync `kit` docs (#1509)" This reverts commit 17212cc.
1 parent 17212cc commit 90a2bab

File tree

2 files changed

+3
-32
lines changed

2 files changed

+3
-32
lines changed

apps/svelte.dev/content/docs/kit/20-core-concepts/60-remote-functions.md

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -161,40 +161,17 @@ export const getPost = query(v.string(), async (slug) => {
161161
162162
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.
163163
164-
### Updating queries
164+
### Refreshing queries
165165
166-
Any query can be re-fetched via its `refresh` method, which retrieves the latest value from the server:
166+
Any query can be updated via its `refresh` method:
167167
168168
```svelte
169169
<button onclick={() => getPosts().refresh()}>
170170
Check for new posts
171171
</button>
172172
```
173173
174-
Alternatively, if you need to update its value manually, you can use the `set` method:
175-
176-
```svelte
177-
<script>
178-
import { getPosts } from './data.remote';
179-
import { onMount } from 'svelte';
180-
181-
onMount(() => {
182-
const ws = new WebSocket('/ws');
183-
ws.addEventListener('message', (ev) => {
184-
const message = JSON.parse(ev.data);
185-
if (message.type === 'new-post') {
186-
getPosts().set([
187-
message.post,
188-
...getPosts().current,
189-
]);
190-
}
191-
});
192-
return () => ws.close();
193-
});
194-
</script>
195-
```
196-
197-
> [!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.
174+
> [!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.
198175
199176
## form
200177

apps/svelte.dev/content/docs/kit/98-reference/[email protected]

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2191,12 +2191,6 @@ type RemotePrerenderFunction<Input, Output> = (
21912191

21922192
```dts
21932193
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 throws an error.
2198-
*/
2199-
set(value: T): void;
22002194
/**
22012195
* On the client, this function will re-fetch the query from the server.
22022196
*

0 commit comments

Comments
 (0)