Skip to content

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

Closed
@JReinhold

Description

@JReinhold

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions