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

Losing Snippet when accidently leaving page #165

Open
mouse0270 opened this issue Nov 20, 2024 · 6 comments
Open

Losing Snippet when accidently leaving page #165

mouse0270 opened this issue Nov 20, 2024 · 6 comments

Comments

@mouse0270
Copy link

Yesterday I was working on a demo using Try.MudBlazor and in about 45 minutes into getting it to work I accidentally refreshed the page of my browser losing everything.

I am used to coding sites like Codepen that will alert the user they are about the leave and lose progress but it appears on Try.MudBlazor you just lose everything.

I noticed that issue #7 was made closed to remove this exact functionality.

My suggestion would be to do one of the following:

  1. Only prevent leaving the page if the user has compiled and not saved. If the snippet let the user leave, if they compile again, renable until they save again.

  2. Provide a button in the sidebar that will let the user toggle the feature on or off. This will let users who are worried about losing data to enable the functionality well leaving all other users unaffected.

@ScarletKuro
Copy link
Member

@henon thoughts?
I know we had this feature before, but it was removed. Maybe we could have a setting to disable / enabled it

@henon
Copy link
Collaborator

henon commented Nov 21, 2024

This is the first time somebody has complained. The feature we disabled was very annoying because it didn't care whether you saved or not. I am really not sure it is worth the time to work on this for us when almost all people seem to have no problem with the current state.

@danielchalmers
Copy link

Does the monaco editor keep track of unsaved changes? Can we leverage that?

@ScarletKuro
Copy link
Member

ScarletKuro commented Nov 23, 2024

Does the monaco editor keep track of unsaved changes? Can we leverage that?

There's probably such a feature, but we don't have a hook for it. Currently, we're using the pure JS version of Monaco, and we haven't updated it in a very long time. I know that MSFT uses the BlazorMonaco nuget for their internal tool, and maybe we should too. Perhaps someone is willing to port it to use that instead, as I'd like to take a break from TryMud for now. (Tho it doesn't seem BlazorMonaco is being very active as well).

@mouse0270
Copy link
Author

There is a feature that lets you track unsaved changes within the Monaco editor. You can easily use this feature to enable and disable the alert to prevent users from leaving the page.

Also if I could figure out how to get this to build and run locally, I'd be happy to make pull request, but I get some error about some settings existing twice or not existing and am to lazy to debug whats happening.

@ScarletKuro
Copy link
Member

Also if I could figure out how to get this to build and run locally, I'd be happy to make pull request, but I get some error about some settings existing twice or not existing and am to lazy to debug whats happening.

Should be pretty much just hit and run, with VS or dotnet build as long as you have .NET9 installed. Mikes was also testing my PRs and was no issues.

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

4 participants