From 0f44abeef2dc4e4d2e9e6b5ec537893d0437cdfe Mon Sep 17 00:00:00 2001 From: LB Johnston Date: Fri, 10 Nov 2023 06:17:41 +1000 Subject: [PATCH] Minimap - Ensure that we correctly handle not found matched elements - Currently the code appears to try to fallback to an empty id, however this will never happen as we are building a non-empty string - Instead if we have not found any closest panel, simply return the intersection map as is Closes #11210 --- client/src/components/Minimap/Minimap.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/src/components/Minimap/Minimap.tsx b/client/src/components/Minimap/Minimap.tsx index 921d83a56b..159bb7ae58 100644 --- a/client/src/components/Minimap/Minimap.tsx +++ b/client/src/components/Minimap/Minimap.tsx @@ -38,8 +38,9 @@ const mapIntersections = ( acc: LinkIntersections, { target, isIntersecting }: IntersectionObserverEntry, ) => { - const href = `#${target.closest('[data-panel]')?.id}` || ''; - acc[href] = isIntersecting; + const id = target.closest('[data-panel]')?.id; + if (!id) return acc; + acc[`#${id}`] = isIntersecting; return acc; };