`invalidateAll` incorrectly resets `page.form`
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
form isn't supposed to be reset when calling invalidateAll. the form you get as a prop isn't reset, and the code explicitly says Reset form on navigation, but not invalidation. and yet, the form from $app/state's page is.
Reproduction
https://github.com/KTibow/sveltekit-invalidateall-issue
click add, then click remove, and note that the page.form ones were incorrectly turned into null
Logs
System Info
System:
OS: Linux 6.14 Ubuntu 25.04 25.04 (Plucky Puffin)
CPU: (12) arm64 unknown
Memory: 4.00 GB / 14.20 GB
Container: Yes
Shell: 4.0.1 - /usr/bin/fish
Binaries:
Node: 23.11.0 - ~/.local/share/pnpm/node
npm: 10.9.2 - ~/.local/share/pnpm/npm
pnpm: 10.11.0 - ~/.local/share/pnpm/pnpm
npmPackages:
@sveltejs/adapter-auto: ^6.0.0 => 6.0.1
@sveltejs/kit: ^2.16.0 => 2.21.1
@sveltejs/vite-plugin-svelte: ^5.0.0 => 5.0.3
svelte: ^5.0.0 => 5.33.2
vite: ^6.2.6 => 6.3.5
Severity
serious, but I can work around it
Additional Information
claude thinks this change to get_navigation_result_from_branch would fix it (seems to fix my specific repro)
- form: form ?? null,
+ form: form !== undefined ? form : page.form,
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 in packages/kit/src/runtime/client/client.js, especially get_navigation_result_from_branch and the nearby navigation state handling. Run the linked reproduction and use invalidateAll after adding and removing data; done means page.form from $app/state remains available instead of becoming null, while the existing prop behavior is preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100