-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Description
Describe the bug
If I have a form like this:
<form {...addTodo.enhance(async ({ data, submit }) => {
await submit().updates(
get_todos().withOverride((todos) => [...todos, { text: data.get('text') }])
);
}}>
but for whatever reason get_todos()
isn't currently being used elsewhere on the page (i.e. the todos component isn't mounted) the following issue happens:
- SvelteKit calls
create_remote_function
- Cache miss -
query_map
doesn't containget_todos()
- SvelteKit initializes
get_todos()
and makes a fetch request to the endpoint get_todos()
gets cachedget_todos()
gets immediately removed from the cache, because there are no references to it- Repeat steps 2-5, every time the form is submitted.
Reproduction
Logs
System Info
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 20.19.1 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.8.2 - /usr/local/bin/npm
pnpm: 8.15.6 - /usr/local/bin/pnpm
npmPackages:
@sveltejs/adapter-auto: ^6.0.0 => 6.1.0
@sveltejs/kit: ^2.22.0 => 2.36.1
@sveltejs/vite-plugin-svelte: ^6.0.0 => 6.1.3
svelte: ^5.25.0 => 5.38.2
vite: ^7.0.4 => 7.1.3
Severity
serious, but I can work around it
Additional Information
No response
calasanmarko
Metadata
Metadata
Assignees
Labels
No labels