Skip to content

updating a default value props with undefined in an each block does not work properly #8020

@Ennoriel

Description

@Ennoriel

Describe the bug

I have a list that can be filtered, displayed with an <Item/> component in an each block. The item component has only one props which has a default value.

The first rendering works well, the Item props takes the props or set the default value if the props is undefined. After filtering, the item of the list with a value "undefined" will not be displayed correctly with the default value of the <Item/> component.

I tried with and without a keyed each block. It does not change anything.

I'd exepect that the default value is set even after filtering.

There is workarounds: setting the default value when the value is used : {value || "default value"}

Reproduction

Here is a REPL: https://svelte.dev/repl/4944b2037a034b7fb50806e801f080cf?version=3.53.1

Logs

No response

System Info

svelte - 3.53.1

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions