You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[deep-review][duplication] D1: CopyTextToClipboard duplicated across 17 sites #364
Two byte-identical CopyTextToClipboard methods plus 15 other sites that inline the same new DataPackage(); SetText; SetContent ritual. Total: 17 call sites doing the same three operations.
Where
src/OpenClaw.Tray.WinUI/App.xaml.cs:4395 — CopyTextToClipboard (one of two byte-identical implementations)
src/OpenClaw.Tray.WinUI/Dialogs/QuickSendDialog.cs:344 — CopyTextToClipboard (the other byte-identical implementation)
15 other call sites where the three-line pattern new DataPackage(), .SetText(...), Clipboard.SetContent(...) is inlined directly. Easiest find: grep -rn "Clipboard.SetContent" src/.
PR #336 (refactor/extract-copy-diagnostic-helper) already established a sibling seam — CopyDiagnosticHelper — for the redacted-diagnostic copy operations. The same seam can absorb plain text copy.
Why it matters
Three-line patterns are exactly where AI-assisted edits introduce subtle behavior differences. E.g., one site forgets try { } catch (COMException) { } to guard against the clipboard being held by another process; another adds it. Drift accumulates.
New developers can't find the canonical helper because there isn't one.
I've opened a draft PR that removes the two CopyTextToClipboard wrapper methods and points all 7 call sites directly to ClipboardHelper.CopyText.
ClipboardHelper.CopyText was already the canonical helper — both wrappers were thin delegates that did nothing but forward to it. The PR deletes them and updates:
Closing during the post-refactor deep-review cleanup. Clipboard duplication is much smaller in the current tree and is consolidated into #372 as a scoped cleanup item. This keeps the signal while reducing stale one-off issue noise.
Activity
refactor: consolidate CopyTextToClipboard into ClipboardHelper
github-actions commentedon May 16, 2026
🤖 This is an automated response from Repo Assist.
I've opened a draft PR that removes the two
CopyTextToClipboardwrapper methods and points all 7 call sites directly toClipboardHelper.CopyText.ClipboardHelper.CopyTextwas already the canonical helper — both wrappers were thin delegates that did nothing but forward to it. The PR deletes them and updates:App.xaml.cs— 4 internal calls + method definition removedQuickSendDialog.cs— 2 calls + method definition removedOnboarding/Pages/ConnectionPage.cs— 1 call updated fromApp.CopyTextToClipboardtoClipboardHelper.CopyTextNo behaviour change.
shanselman commentedon May 18, 2026
Closing during the post-refactor deep-review cleanup. Clipboard duplication is much smaller in the current tree and is consolidated into #372 as a scoped cleanup item. This keeps the signal while reducing stale one-off issue noise.