Skip to content

Commit

Permalink
fix(frontend): copy on first hotkey stroke
Browse files Browse the repository at this point in the history
A temporary fix #437
  • Loading branch information
saihaj committed Jun 1, 2020
1 parent fc01ec5 commit 3930ec3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/frontend/src/lib/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,12 @@ export const useCopyToClipboard = () => {
const truncate = input => ( input.length > 30 ? `${input.substring( 0, 30 )}...` : input )

const { enqueueSnackbar } = useSnackbar()

return ( text, fallback = 'No text to copy' ) => {
if ( text ) copy( text )
// Refactor when this is resolved https://github.com/sudodoki/copy-to-clipboard/issues/90
if ( text ) {
copy( text )
copy( text )
}

enqueueSnackbar(
text ? `Copied "${truncate( text )}" to clipboard` : fallback,
Expand Down

0 comments on commit 3930ec3

Please sign in to comment.