Skip to content

Default data not re-added when removing property value #1467

Closed
@jacobmischka

Description

@jacobmischka

The current behavior makes sense, but it would be great if default data could somehow be reinjected if previously-provided data gets removed. It can particularly get in the way when using spread for props.

REPL: https://svelte.technology/repl?version=2.6.1&gist=b2cd6467f026d0b3a0857d248d44f830

It may be sort of related to #1434, but I actually want the falsey values passed down, I just want the default data ones to re-take effect.

I guess I basically am wanting an implicit something like this:

onstate({ current }) { this.set(Object.assign(defaultData, current)); }

Edit: I guess using Object.assign for this doesn't work, becuase undefined is indeed a value which is overriding the defaults. I wonder if this is what's causing the issue in the first place.

Thanks!

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