You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This load method has an await (e.g. fetching data remotely)
The blur method is triggered from an input when navigating with the back/forward keys in the browser
I'm not really sure what the correct "mental model" is of this behaviour - but my two cents is that it feels wrong. It's really difficult to spot, as there's no typing that tells me that this can happen. The generated type-definition of let { data } = $props() is:
letdata: {state: {message: string;};}
It's really difficult to spot that this can happen since the type-definition says that state should always be defined in this context.
+page.svelte?t=1759308998689:23 Uncaught TypeError: Cannot set properties of undefined (setting 'message')
at HTMLInputElement.<anonymous> (+page.svelte?t=1759308998689:23:93)
at events.js:61:21
at without_reactive_context (shared.js:44:10)
at HTMLInputElement.target_handler (events.js:60:11)
at remove_effect_dom (effects.js:524:8)
at destroy_effect (effects.js:471:3)
at destroy_effect_children (effects.js:435:4)
at destroy_effect (effects.js:475:2)
at destroy_effect_children (effects.js:435:4)
at destroy_effect (effects.js:475:2)
Describe the bug
Relevant issues:
Relevant fixes:
It seems like this bug occurs when:
I'm not really sure what the correct "mental model" is of this behaviour - but my two cents is that it feels wrong. It's really difficult to spot, as there's no typing that tells me that this can happen. The generated type-definition of
let { data } = $props()is:It's really difficult to spot that this can happen since the type-definition says that state should always be defined in this context.
Reproduction
Github repro: https://github.com/MathiasWP/sveltekit-input-onblur-async-state-bug
Video:
Screen.Recording.2025-10-01.at.17.48.06.mov
Logs
System Info
System: OS: macOS 15.6.1 CPU: (8) arm64 Apple M1 Pro Memory: 274.14 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 22.14.0 - ~/.nvm/versions/node/v22.14.0/bin/node npm: 10.9.2 - ~/.nvm/versions/node/v22.14.0/bin/npm pnpm: 10.6.5 - /opt/homebrew/bin/pnpm bun: 1.0.0 - ~/.bun/bin/bun Browsers: Brave Browser: 139.1.81.137 Chrome: 140.0.7339.208 Edge: 140.0.3485.94 Safari: 18.6 npmPackages: svelte: ^5.0.0 => 5.39.7Severity
annoyance
Additional Information
No response