solid-playground icon indicating copy to clipboard operation
solid-playground copied to clipboard

Share button doesn't change page URL

Open edemaine opened this issue 3 years ago • 5 comments

As reported in Discord, clicking on the Share button copies the short URL to the clipboard, but doesn't change the page URL (window.location); it remains the long URL. This is confusing behavior.

On the deployed site, I don't even see the brief change in icon to a chain link anymore (but I do see it on a dev server, even though it's failing to do the PUT).

edemaine avatar May 10 '22 13:05 edemaine

Yeah I think we pushed the work I was doing on the share button a bit prematurely. I reckon I'm being a bit inactive these days and its showing. I'll try to investigate the issue, thanks for reporting!

amoutonbrady avatar May 16 '22 20:05 amoutonbrady

I misread the issue. There's no real issue. You are pointing out a behavior that seems confused (rightfully so!) Do you have a better proposal than the actual implementation? I'm all hear :)

amoutonbrady avatar May 16 '22 20:05 amoutonbrady

I'd propose the following behavior:

  1. After content doesn't change for a bit of time, the window.location URL updates to the long explicit form (#...) automatically. This just costs a little time but no storage, and ensures that the URL is almost always a representation of the current reality. (Currently it doesn't update until you click Share.)
  2. After clicking Share button, the short URL (?hash=...) is copied to clipboard (as currently) and the window.location URL changes to that as well. When the content changes again, the URL becomes the long form again (via Rule 1 above).

edemaine avatar May 18 '22 15:05 edemaine

It seems like neither of the suggested behaviors are live on https://stage-playground.solidjs.com/scratchpad — is it OK to reopen this issue?

edemaine avatar Jul 18 '22 01:07 edemaine

The share button changes the URL for me every time.

https://github.com/solidjs/solid-playground/assets/297678/d5def9dc-4c86-449a-8bb4-a9459846f34b

trusktr avatar Sep 25 '23 20:09 trusktr