carbon icon indicating copy to clipboard operation
carbon copied to clipboard

Fixed copying of updated URL to clipboard when new snippets are saved

Open agilityhawk opened this issue 2 years ago • 3 comments

The issue was observable under Copy to Clipboard > Medium.com / IFrame / Plain URL.

  • All three of these Components use the CopyEmbed component underneath that makes us of the asPath property of the nextrouter.
  • This property was not getting updated because we were using window.history.pushState instead of the router methods (push/replace).
  • Have used router.push here since this gets invoked only when a new snippet is created.

Caveat: Since there is a single page reload when the new snippet is created now, the page scrolls back to the top. I believe this should be a minor trade-off for making the Copy functionality work as expected.

Closes #1379

agilityhawk avatar Jan 25 '23 13:01 agilityhawk

@agilityhawk is attempting to deploy a commit to the Carbon Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Jan 25 '23 13:01 vercel[bot]

(bump). Any chance to getting this reviewed / taking it forward?

agilityhawk avatar May 23 '23 12:05 agilityhawk

@mfix22 review/merge please?

agilityhawk avatar Mar 15 '24 10:03 agilityhawk