Skip to content

Tutorial still says "derived state is read-only" - needs update #1225

Open
@rmunn

Description

@rmunn

Describe the problem

The last line of https://svelte.dev/tutorial/svelte/derived-state says, "Unlike normal state, derived state is read-only." This is no longer true as of Svelte v5.25.0: sveltejs/svelte#15570 made it possible to temporarily override derived state with a new value (though any time the underlying state changes and the derived calculation re-runs the temporary override will be replaced with a calculated value again).

Describe the proposed solution

We should probably update the tutorial to give an example of overriding derived state and having it go back to its derived state when re-computed. Perhaps a simple counter with a derived double value, and a few buttons that can set the doubled value to 5, 15, or 25. That way it will be easy to observe that the derived value is overridden when set, but that it goes back to a computed value whenever the underlying value changes again.

Importance

would make my life easier

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