Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

fix: bug where it takes two clicks to get a code snippet to copy #1096

Merged
merged 1 commit into from
Dec 9, 2020

Conversation

erunion
Copy link
Member

@erunion erunion commented Dec 9, 2020

🧰 What's being changed?

This fixes a bug where it takes two clicks on the code sample copy button to copy the snippet you're looking at.

🧪 Testing

Bug is in production: https://preview.readme.io/

  1. Click the copy button on a code sample. The code you're looking at should exist in your clipboard.
  2. Click on another language tab.
  3. Click the copy button. Code from the previous tab will still be in your clipboard.
  4. Click the copy button again. Code from the new tab should be in your clipboard.

@erunion erunion added the type:bug Something isn't working label Dec 9, 2020
@erunion erunion requested review from darrenyong and Dashron December 9, 2020 21:30
Copy link
Member

@domharrington domharrington left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Any idea how this could've happened? Or how long this has been an issue for?

@erunion
Copy link
Member Author

erunion commented Dec 9, 2020

I'm not sure how long this has been in place. I pushed some minor proptype updates to CopyCode with the JSON editor to fix some test warnings, but reverting those locally it didn't fix it. The CopyCode usage in CodeSample also hasn't changed in 2 years.

Might've been a side effect of some React updates we did with the JSON editor?

@erunion erunion merged commit e5bd424 into next Dec 9, 2020
@erunion erunion deleted the fix/copy-code-wrong-snippet branch December 9, 2020 21:35
@erunion
Copy link
Member Author

erunion commented Dec 9, 2020

Ticket that spawned this was created back on October 22nd which is the day after the initial tutorials work was integrated in in #958 so it's possible React issues with that did it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type:bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants