Skip to content

The data prop and subsequent $derived not mutable by default #13626

Open
@henrykrinkle01

Description

@henrykrinkle01

Describe the bug

Now that $derived has been made writable. This is intended to make optimistic UI updates possible without having to use the $state in $derived.by dance. However, it still doesn't entirely solve the problem because data is a $state.raw, which means mutations to data or its deriveds won't update the UI. To make it work like Svelte 4 did, the trick is still needed, which is kinda ugly and not beginner friendly.

I believe making data a full $state instead of $state.raw would solve this problem. Any reasons not to do so?

Reproduction

https://svelte.dev/playground/a69b38c2e041412989ca3edb509a0138?version=5.25.2

Logs

System Info

Svelte 5.25.2
SvelteKit 2.20.2

Severity

annoyance

Additional Information

No response

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