SSR `query.batch` result disappears on hydration
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 2.3k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 156
Description
Describe the bug
According to https://github.com/sveltejs/kit/issues/15826 the 1st query.remote is not recalled on the client.
The result is in the HTML and reused, and the server rendered HTML is correct.
{#each await getLiveLessons() as lesson (lesson.id)}
<!-- all `query.batch` remote functions: -->
{@const cls = await getLiveLessonClass(lesson.classId)}
{@const teacher = await getTeacher(lesson.teacherId)}
{@const students = await getLiveLessonStudentCenter(lesson.classId)}
{/each}
However cls becomes undefined in the client during hydration.
After refreshing (F5), the cls?.subject is shown and then turned into blank.
Reproduction
When getTeacher is the 1st @const block, the 4th column disappear.
When getLiveLessonClass is the 1st @const block, 2nd and 3rd columns disappear.
https://github.com/user-attachments/assets/8b5c1005-1beb-460b-a3ba-dc1d2e8a24b2
https://github.com/hyunbinseo/svelte-kit-templates/tree/svelte-kit-15826
Logs
System Info
System:
OS: Windows 11 10.0.26200
CPU: (8) x64 Intel(R) Core(TM) Ultra 7 258V
Memory: 4.78 GB / 31.48 GB
Binaries:
Node: 24.15.0 - C:\Users\hyunb\AppData\Local\fnm_multishells\19996_1778584201985\node.EXE
npm: 11.12.1 - C:\Users\hyunb\AppData\Local\fnm_multishells\19996_1778584201985\npm.CMD
pnpm: 10.33.2 - C:\Users\hyunb\AppData\Local\fnm_multishells\19996_1778584201985\pnpm.CMD
Deno: 2.4.0 - C:\Users\hyunb\.deno\bin\deno.EXE
Browsers:
Chrome: 148.0.7778.96
Edge: Chromium (140.0.3485.54)
Firefox: 150.0.2 - C:\Program Files\Mozilla Firefox\firefox.exe
npmPackages:
@sveltejs/adapter-auto: ^7.0.1 => 7.0.1
@sveltejs/kit: ^2.59.1 => 2.59.1
@sveltejs/vite-plugin-svelte: ^7.1.2 => 7.1.2
svelte: ^5.55.5 => 5.55.5
vite: ^8.0.12 => 8.0.12
Severity
blocking all usage of SvelteKit
Additional Information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the linked svelte-kit-15826 reproduction and inspect the SSR and hydration behavior of the query.batch remote functions, especially the first @const block inside the each block. Done means cls, teacher, and students remain available after hydration and after a refresh, regardless of their ordering.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend, frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100