diff --git a/frontend-modern/src/components/Settings/AgentIntegrationsPanel.tsx b/frontend-modern/src/components/Settings/AgentIntegrationsPanel.tsx index 9a15c3e94..577765828 100644 --- a/frontend-modern/src/components/Settings/AgentIntegrationsPanel.tsx +++ b/frontend-modern/src/components/Settings/AgentIntegrationsPanel.tsx @@ -94,10 +94,15 @@ export const AgentIntegrationsPanel: Component = () => { () => surfaceContractEntries().length > 0 || hasManifestInventory(), ); + let copySnippetTimer: ReturnType | undefined; const handleCopySnippet = (snippet: string) => { setCopied(snippet); - window.setTimeout(() => setCopied(null), 2000); + if (copySnippetTimer) clearTimeout(copySnippetTimer); + copySnippetTimer = setTimeout(() => setCopied(null), 2000); }; + onCleanup(() => { + if (copySnippetTimer) clearTimeout(copySnippetTimer); + }); const readRouteHash = () => (typeof window === 'undefined' ? '' : window.location.hash);