From 751a874c5119fc7e209f6309a2c6235d146f5222 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 18 Dec 2025 13:38:52 +0200 Subject: [PATCH] chore(highlights_list): improve performance by matching fewer elements --- apps/client/src/widgets/sidebar/HighlightsList.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/client/src/widgets/sidebar/HighlightsList.tsx b/apps/client/src/widgets/sidebar/HighlightsList.tsx index 755071cab..4007cc91f 100644 --- a/apps/client/src/widgets/sidebar/HighlightsList.tsx +++ b/apps/client/src/widgets/sidebar/HighlightsList.tsx @@ -180,6 +180,8 @@ function ReadOnlyTextHighlightsList() { function extractHeadingsFromStaticHtml(el: HTMLElement | null) { if (!el) return []; + const { color: defaultColor, backgroundColor: defaultBackgroundColor } = getComputedStyle(el); + const walker = document.createTreeWalker( el, NodeFilter.SHOW_TEXT, @@ -197,7 +199,8 @@ function extractHeadingsFromStaticHtml(el: HTMLElement | null) { if ( el.closest('strong, em, u') || - style.color || style.backgroundColor + style.color !== defaultColor || + style.backgroundColor !== defaultBackgroundColor ) { const attrs: RawHighlight["attrs"] = { bold: !!el.closest("strong"),