Describe the bug
Hi!
I started experiencing some issues of queries not updating when I call .updates() on them and after a lot of testing I found the cause.
If you use a schema that transforms the input (like valibot's v.transform()) sveltekit fails to update the query, I assume because the backend sends to the frontend the transformed input and the frontend tries to find the query instance that has that input but it can't cause it was transformed.
If you remove the v.transform it works as it should.
I'm not sure if this a known issue, couldn't find anything about this.
Let me know if you want a reproduction repo.
Thank you!
Reproduction
Here is a quick example (you need to install valibot npm i -D valibot):
// the remote functions
import { command, query, requested } from "$app/server";
import * as v from "valibot";
let myList: number[] = [];
export const addToMyList = command(async () => {
myList.push(0);
await requested(getMyList, 1).refreshAll();
});
export const getMyList = query(
v.pipe(
v.number(),
v.transform((n) => String(n)),
),
(n) => {
return myList;
},
);
The client code:
<script lang="ts">
import { addToMyList, getMyList } from "$lib/test.remote";
</script>
<button onclick={async () => await addToMyList().updates(getMyList(1))}>Add</button>
<p>{(await getMyList(1)).join(", ")}</p>
Has you can see, 1 is passed both to the await getMyList(1) and to the updates(getMyList(1)) but it doesn't get refreshed when you click "Add".
Logs
System Info
System:
OS: Windows 11 10.0.26100
CPU: (28) x64 13th Gen Intel(R) Core(TM) i7-13850HX
Memory: 12.89 GB / 31.55 GB
Binaries:
Node: 25.9.0 - C:\Users\z0057a7a\AppData\Local\pnpm\node.EXE
npm: 11.12.1 - C:\Users\z0057a7a\AppData\Local\pnpm\npm.CMD
pnpm: 10.33.0 - C:\Users\z0057a7a\AppData\Local\pnpm\pnpm.CMD
bun: 1.3.11 - C:\Users\z0057a7a\scoop\shims\bun.EXE
Browsers:
Edge: Chromium (145.0.3800.65)
npmPackages:
@sveltejs/adapter-node: ^5.5.4 => 5.5.4
@sveltejs/kit: ^2.57.0 => 2.57.1
@sveltejs/vite-plugin-svelte: ^7.0.0 => 7.0.0
svelte: ^5.55.2 => 5.55.2
vite: ^8.0.7 => 8.0.8
Severity
serious, but I can work around it
Additional Information
No response
Describe the bug
Hi!
I started experiencing some issues of queries not updating when I call
.updates()on them and after a lot of testing I found the cause.If you use a schema that transforms the input (like valibot's
v.transform()) sveltekit fails to update the query, I assume because the backend sends to the frontend the transformed input and the frontend tries to find the query instance that has that input but it can't cause it was transformed.If you remove the
v.transformit works as it should.I'm not sure if this a known issue, couldn't find anything about this.
Let me know if you want a reproduction repo.
Thank you!
Reproduction
Here is a quick example (you need to install valibot
npm i -D valibot):The client code:
Has you can see,
1is passed both to theawait getMyList(1)and to theupdates(getMyList(1))but it doesn't get refreshed when you click "Add".Logs
System Info
System: OS: Windows 11 10.0.26100 CPU: (28) x64 13th Gen Intel(R) Core(TM) i7-13850HX Memory: 12.89 GB / 31.55 GB Binaries: Node: 25.9.0 - C:\Users\z0057a7a\AppData\Local\pnpm\node.EXE npm: 11.12.1 - C:\Users\z0057a7a\AppData\Local\pnpm\npm.CMD pnpm: 10.33.0 - C:\Users\z0057a7a\AppData\Local\pnpm\pnpm.CMD bun: 1.3.11 - C:\Users\z0057a7a\scoop\shims\bun.EXE Browsers: Edge: Chromium (145.0.3800.65) npmPackages: @sveltejs/adapter-node: ^5.5.4 => 5.5.4 @sveltejs/kit: ^2.57.0 => 2.57.1 @sveltejs/vite-plugin-svelte: ^7.0.0 => 7.0.0 svelte: ^5.55.2 => 5.55.2 vite: ^8.0.7 => 8.0.8Severity
serious, but I can work around it
Additional Information
No response