kit icon indicating copy to clipboard operation
kit copied to clipboard

`invalidateAll` incorrectly resets `page.form`

Open KTibow opened this issue 6 months ago • 0 comments

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,

KTibow avatar May 25 '25 19:05 KTibow