Skip to content

Commit 8a59a0d

Browse files
authored
docs: clarify query.batch code example (#15289)
1 parent 7492085 commit 8a59a0d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

documentation/docs/20-core-concepts/60-remote-functions.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,22 +190,22 @@ import * as v from 'valibot';
190190
import { query } from '$app/server';
191191
import * as db from '$lib/server/database';
192192

193-
export const getWeather = query.batch(v.string(), async (cities) => {
193+
export const getWeather = query.batch(v.string(), async (cityIds) => {
194194
const weather = await db.sql`
195195
SELECT * FROM weather
196-
WHERE city = ANY(${cities})
196+
WHERE city_id = ANY(${cityIds})
197197
`;
198-
const lookup = new Map(weather.map(w => [w.city, w]));
198+
const lookup = new Map(weather.map(w => [w.city_id, w]));
199199

200-
return (city) => lookup.get(city);
200+
return (cityId) => lookup.get(cityId);
201201
});
202202
```
203203
204204
```svelte
205205
<!--- file: Weather.svelte --->
206206
<script>
207207
import CityWeather from './CityWeather.svelte';
208-
import { getWeather } from './weather.remote.js';
208+
import { getWeather } from './weather.remote';
209209

210210
let { cities } = $props();
211211
let limit = $state(5);

0 commit comments

Comments
 (0)