Skip to content

Commit

Permalink
Components: Fix the 'ClipboardButton' effect cleanup (#67399)
Browse files Browse the repository at this point in the history
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: tyxla <[email protected]>
  • Loading branch information
3 people authored Nov 28, 2024
1 parent 5efeef9 commit db263fb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/components/src/clipboard-button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ export default function ClipboardButton( {
} );

useEffect( () => {
if ( timeoutIdRef.current ) {
clearTimeout( timeoutIdRef.current );
}
return () => {
if ( timeoutIdRef.current ) {
clearTimeout( timeoutIdRef.current );
}
};
}, [] );

const classes = clsx( 'components-clipboard-button', className );
Expand Down

0 comments on commit db263fb

Please sign in to comment.