carbon
carbon copied to clipboard
Fixed copying of updated URL to clipboard when new snippets are saved
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 is attempting to deploy a commit to the Carbon Team on Vercel.
A member of the Team first needs to authorize it.
(bump). Any chance to getting this reviewed / taking it forward?
@mfix22 review/merge please?