Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Svelte 5: Fallback props becomes undefined if another prop is changed #9716

Closed
JReinhold opened this issue Nov 30, 2023 · 0 comments · Fixed by #9717
Closed

Svelte 5: Fallback props becomes undefined if another prop is changed #9716

JReinhold opened this issue Nov 30, 2023 · 0 comments · Fixed by #9717
Labels
Milestone

Comments

@JReinhold
Copy link

JReinhold commented Nov 30, 2023

Describe the bug

I'm seeing a regression with undefined and fallback props in Svelte 5.

If a component has a prop with a fallback, and you pass in undefined either explicitly or with {...props}, it will render fine with the fallback set the first time. However when changing any of the other props afterwards, the prop will no longer be the fallback but instead be undefined.

This happens in Svelte 5, but in Svelte 4 it stays the fallback forever as I'd expect.

Reproduction

In the following reproductions, clicking the button will change the boolean prop. In Svelte 4 the text prop stays the default text, but in Svelte 5 the text disappears because it becomes undefined.

Reproduction in Svelte 4, showing it works:
https://svelte.dev/repl/9a798c8fe7f44aef8e728884aa6fe417?version=4.2.7

Svelte 5 with the bug:
https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAE61T22rjMBD9lVlRmgQS-92xDdvSHygL-7DeB8cZJ2JlyUhyaTH69x3Z8a1NSx4KBjFn5py5umUlF2hY9KdlMq-QRexnXbMts2-1N8wLCotkG9XowiOxKTSvbZrJzPKqVtrCo6JXorRQalXBKghHJOgFVvtZ-HMj8SNlgc5pRBRoodaqNpBA64HMGlXhg1IiAqsb9JibBXuvPXN5ehIGiVTm9JI_DqfqZXxorFUSlIwKwYt_SbveQJJC26UKhgwD3bm0OOfyhHAgNA57dup1dEjPb27PcC-K5rAPgqDTuNfeooip3XbwubAvYjmND-4fu90ygy_rF77apE811erBKwmHNpJ3bblJqV2KOLjknmWVqhvnbcqetduldDWVOvKS45FFfktuOx7ZqHLrqeFrdzvDcn2dtJiMUVkG6DtimTfCZmx_JdpXdbmOuwgKJY0SGAh1Wq9ov8a-CVxtoR2EtyPJbd7fzJG_pGOgi0Nvz-GO1cNf9b_Y-q0z8IXTiXw5AMgN5KBJPmNTH-Ao9q5b03ozTALLEgu7vhx9_1stZuNVPp8L_XHfO52_7j8evR8KjgQAAA==

Logs

No response

System Info

https://svelte-5-preview.vercel.app

Severity

blocking an upgrade

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants