stackblitz / tutorialkit

TutorialKit by StackBlitz - Create interactive tutorials powered by the WebContainer API
https://tutorialkit.dev
MIT License
249 stars 24 forks source link

Add an `Undo` button to revert to user state after clicking on `Solve` #216

Open Barbapapazes opened 1 month ago

Barbapapazes commented 1 month ago

Describe the bug

Hello 👋,

The editor does not retain the changes when showing the solution.

Link to a StackBlitz project which shows the error

No response

Steps to reproduce

  1. Go to https://demo.tutorialkit.dev/forms-tutorial/introduction/welcome/
  2. Change something in the editor
  3. Click on solve
  4. Click on reset

No more changes

Expected behavior

Maybe this is an expected behavior but having the ability to compare my solution with the provided is important in the process to learn. The reset button could still exists but to clean the editor, not to go back to the user solution.

Screenshots

No response

Platform

Additional context

No response

Nemikolh commented 1 month ago

Hey @Barbapapazes! Thanks for opening this issue!

This is indeed the expected behaviour. You have a similar experience on https://learn.svelte.dev for instance.

I do think we could have an "Undo" button / feature as right now pressing Solve and then Ctrl+z will only work for the currently opened file.

I would argue that "Reset" has the intended behaviour though as being able to go back to the initial state is also very useful.

@AriPerkkio Let's mark this as an enhancement instead of a bug.