From fdc49dc0029e0d48e92f1c1623a94c2e11ef4f62 Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Mon, 10 Mar 2025 09:29:33 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(frontend)=20remove=20scroll=20list?= =?UTF-8?q?ener=20table=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit During a useEffect cleaning, the selector was not the correct one. The debounce was not being removed correctly neither. --- CHANGELOG.md | 7 ++++++- .../components/TableContent.tsx | 19 +++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index edde5b88..1566ee63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ and this project adheres to ## [Unreleased] +## Fixed +- 🐛(frontend) remove scroll listener table content #688 +- 🔒️(back) restrict access to favorite_list endpoint #690 + + ## [2.4.0] - 2025-03-06 ## Added @@ -21,7 +26,7 @@ and this project adheres to ## Fixed - 🐛(frontend) fix collaboration error #684 -- 🔒️(back) restrict access to favorite_list endpoint #690 + ## [2.3.0] - 2025-03-03 diff --git a/src/frontend/apps/impress/src/features/docs/doc-table-content/components/TableContent.tsx b/src/frontend/apps/impress/src/features/docs/doc-table-content/components/TableContent.tsx index 4ad01fa0..d6dc4086 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-table-content/components/TableContent.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-table-content/components/TableContent.tsx @@ -48,16 +48,27 @@ export const TableContent = () => { } }; - document.getElementById(MAIN_LAYOUT_ID)?.addEventListener('scroll', () => { - setTimeout(() => { + let timeout: NodeJS.Timeout; + const scrollFn = () => { + if (timeout) { + clearTimeout(timeout); + } + + timeout = setTimeout(() => { handleScroll(); }, 300); - }); + }; + + document + .getElementById(MAIN_LAYOUT_ID) + ?.addEventListener('scroll', scrollFn); handleScroll(); return () => { - window.removeEventListener('scroll', handleScroll); + document + .getElementById(MAIN_LAYOUT_ID) + ?.removeEventListener('scroll', scrollFn); }; }, [headings, setHeadingIdHighlight]);