ui: Improve performance in the CopyButton component (#47292)

This PR improves the performance of the `CopyButton` component by
tracking the copied state locally through a `CopyButtonState` struct
instead of making an OS call every time the component re-renders. Also
pushing a slight improvement here by resetting the state after two
seconds so as to make the check mark go away after you clicked to copy.

Release Notes:

- N/A
This commit is contained in:
Danilo Leal authored and GitHub committed 2026-01-21 13:40:42 -03:00
1 parent 099650fdfb
commit e1e7676b5a
11 files changed
+89 -44

No files matched your search

+4 -1
View File
@@ -343,7 +343,10 @@ impl Render for CommitTooltip {
),
)
.child(Divider::vertical())
.child(CopyButton::new(full_sha).tooltip_label("Copy SHA")),
.child(
CopyButton::new("copy-commit-sha", full_sha)
.tooltip_label("Copy SHA"),
),
),
),
)