-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: reopening closed playground loses content #49895
Comments
CC @rsc ? Should I be directing this to someone else, or to a group? |
Just bitten by this badly for the nth time after spending 15 minutes editing some code only to lose it. Any chance of a fix, please? |
I think it's a race between https://go.googlesource.com/website/+/refs/heads/master/_content/js/playground.js#553 and whatever does the restoring (browser?) |
Yes, a race sounds about right - I thought I saw my content appear for a moment before before deleted. |
(CC @jamalc as someone on the Go team who might know things about browsers) |
I have tested this issue with a local modified js file, and it turns out that the culprit is https://go.googlesource.com/website/+/refs/heads/master/_content/js/playsite.js#26. I have sent out a CL to remove this line, hopefully that it will fix this issue. |
Change https://go.dev/cl/407055 mentions this issue: |
Hi @jamalc, I found that the CL has been deployed and just had a test. Unfortunately, it doesn't fix this issue reliably. The flow is like this:
Either case 1 or case 2 will happen, but not both. I think we have to remove |
Change https://go.dev/cl/408414 mentions this issue: |
I found another issue caused by https://go.dev/cl/407055. When we open a shared code (for example, https://go.dev/play/p/cnjP1PbosLa). The "Run" action could send
I'm very sorry for the error. https://go.dev/cl/408414 will fix this issue too. |
The purpose is to avoid overwriting user content restored by opening recently closed tab from the history. It turns out that https://golang.org/cl/407055 does not address the issue reliably. If the run action happens before the user content is restored, the source code of the "hello world" example will be sent to the server for formatting. Most of the time (if not always), the format result will return after the user content is restored. In this case, the format result will overwrite the restored user content. We can delay the run action until the user content is restored. But it's subtle to decide how long to delay. On the other hand, I think it does not make sense to run the "hello world" example on load, so I prefer to address the issue by removing the run action on page load. Fixes golang/go#49895 Fixes golang/go#53065 Change-Id: Ia044103e79a15d0b351e4257af3aa74558c302d9 GitHub-Last-Rev: 40170ad GitHub-Pull-Request: #162 Reviewed-on: https://go-review.googlesource.com/c/website/+/408414 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
With the old playground, if you close the tab (I do this quite often accidentally when I type ctrl-w trying to delete the last word), reopening it would bring it back without losing any content. You can easily verify this by trying the old playground at go.
In the new playground, the reopened tab reverts the content to its original state, which can be very frustrating if one has spent a while editing there.
The text was updated successfully, but these errors were encountered: