From de65e44d3afd833a5af46198019ee55aef1de0ee Mon Sep 17 00:00:00 2001 From: STetsing <41009393+STetsing@users.noreply.github.com> Date: Mon, 6 Jan 2025 17:29:29 +0100 Subject: [PATCH] rm multiple same listeners --- libs/remix-ui/remix-ai/src/lib/components/Default.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/remix-ui/remix-ai/src/lib/components/Default.tsx b/libs/remix-ui/remix-ai/src/lib/components/Default.tsx index 080400ddfd..ae1a376d93 100644 --- a/libs/remix-ui/remix-ai/src/lib/components/Default.tsx +++ b/libs/remix-ui/remix-ai/src/lib/components/Default.tsx @@ -36,6 +36,9 @@ export const Default = (props) => { Array.from(codeBlocks).forEach((block) => { const copyButtons = block.getElementsByClassName('nlux-comp-copyButton'); Array.from(copyButtons).forEach((cp_btn) => { + // remove click event listener if existing + cp_btn.removeEventListener('click', () => {}); + cp_btn.addEventListener('click', async () => { await navigator.clipboard.writeText(block.textContent); });