Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rmunn opened this issue Mar 25, 2025 · 0 comments
Open

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

rmunn opened this issue Mar 25, 2025 · 0 comments

Comments

@rmunn
Copy link

rmunn commented Mar 25, 2025

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

@Conduitry Conduitry transferred this issue from sveltejs/svelte Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant