Skip to content

Refactor: Extract duplicated copy-to-clipboard logic into reusable hook #31314

@SherlockShemol

Description

@SherlockShemol

Problem

The copy-to-clipboard logic is duplicated across multiple components:

  • CopyIcon
  • CopyFeedback
  • CopyFeedbackNew
  • InputWithCopy

Each component has its own implementation of the same useState + debounce pattern, making maintenance harder and code harder to read.

Proposed Solution

Extract the shared logic into a custom useCopyToClipboard hook that can be reused across all components.

Benefits

  • Reduces ~67 lines of duplicate code
  • Single source of truth for copy behavior
  • Easier to maintain and extend

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions