sveltejs / learn.svelte.dev

A soup-to-nuts interactive tutorial on how to build apps with Svelte
https://learn.svelte.dev
MIT License
528 stars 245 forks source link

session state/store #177

Open gh-osama opened 1 year ago

gh-osama commented 1 year ago

going between pages clears my editor state. would you be open to a PR which retains last known state of editor for each section in local storage? second order gain: this repo is a great example of a production ready sveltekit app and with a store implementation will be even more complete.

Rich-Harris commented 1 year ago

Clearing the editor state is deliberate — the idea is that each exercise is sufficiently small in scope that you're not really losing anything when it gets cleared, and having it automatically reset each time eliminates any confusion that could otherwise arise from the starting point not matching what the text of each section expects it to be. It's supposed to be 'disposable', so that there's no anxiety around whether changes are persisted or not.

But I'm open to persuasion that this is the wrong approach!