sveltejs / svelte

Cybernetically enhanced web apps
https://svelte.dev
MIT License
77.38k stars 4.03k forks source link

Svelte 5 REPL: reload button #11957

Open 7nik opened 3 weeks ago

7nik commented 3 weeks ago

Describe the problem

While messing with REPLs, I often want to "reload the page" / reset the state. However, the only way to do this currently is to add or remove a meaningless space in a code.

Describe the proposed solution

Add a button that "reloads the page" / resets the state.

Importance

nice to have

Conduitry commented 3 weeks ago

Because the contents of all of the files are serialized into the URL, you can already just use the browser's refresh button for this, which seems sufficient to me.

7nik commented 2 weeks ago

Reloading the browser page will trigger re-fetching resources (compiler, bundler, imported modules, etc) and their initialization. The workaround with a space is more efficient and sometimes even faster.

Rich-Harris commented 2 weeks ago

I can relate to this. I'd even venture to suggest intercepting Cmd+R/Ctrl-R keypresses while the output window is focused (maybe that's a step too far).

Design question though: where should the button go? It doesn't really make sense to have it in the space to the right of 'AST Output' since it only applies to the 'Result' tab, and it can't obscure the content. Maybe inside the 'Result' button?

7nik commented 2 weeks ago

I also think it should be inside the Result button. Otherwise, it becomes unclear what it reloads.