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

x/playground: refresh page by mistake will lead to irretrievable data loss #55296

Open
hooluupog opened this issue Sep 21, 2022 · 6 comments
Open
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@hooluupog
Copy link

What version of Go are you using (go version)?

go 1.19

$ go version

Does this issue reproduce with the latest release?

yes.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env

What did you do?

I wrote code in playground with my android phone and lost my code after freshing page by mistake.

  1. Open go playground page with cell phone.
  2. Write anything you want.
  3. Swipe down or pull to refresh page.

What did you expect to see?

Data saved and was still present.

What did you see instead?

Data lost and there was no way to recover it.

I could click share button to generate a page link before writting code in it
to save my data. But this is just a workaround(and there is no share button in golang.google.cn/play).

@gopherbot gopherbot added this to the Unreleased milestone Sep 21, 2022
@cherrymui
Copy link
Member

Not sure if this is feasible.

cc @toothrot

@cherrymui cherrymui added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 21, 2022
@cherrymui cherrymui changed the title x/playground/: refresh page by mistake will lead to irretrievable data loss. x/playground/: refresh page by mistake will lead to irretrievable data loss Sep 21, 2022
@seankhliao seankhliao changed the title x/playground/: refresh page by mistake will lead to irretrievable data loss x/playground: refresh page by mistake will lead to irretrievable data loss Nov 3, 2022
@Deleplace
Copy link
Contributor

Some other playgrounds (Rust, Kotlin) do keep the current source when reloading the page on Android. Ack, they are not the same as the Go playground and may use more complex or stateful user sessions.

@Deleplace
Copy link
Contributor

A fine mitigation would be the page leaving prompt "Are you sure? Data will be lost [Cancel] [OK]" when the user is leaving, and there is unsaved code changed (i.e. no snippet ID in the current URL).

@atdiar
Copy link

atdiar commented Nov 28, 2022

The code's text input could probably be stored in sessionStorage if this is not done already.
Part of the page state is also probably stored in the bfcache though. (recalling in a page load handler may disable the bfcache so one may want to be careful here)

@Deleplace
Copy link
Contributor

I find it a little annoying that opening a "fresh" tab at https://play.rust-lang.org/ and https://dartpad.dev/ brings up the code from the last time I used them, which is probably unrelated and unwanted. I'd prefer we don't do the same.

@atdiar
Copy link

atdiar commented Nov 28, 2022

localStorage would do that. But not sessionStorage as each session is supposed to be "per tab" iirc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants