From 047871c47a52b74d1b0a891c4a22f8d8d526d8dc Mon Sep 17 00:00:00 2001 From: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Date: Sun, 17 May 2026 22:35:51 -0700 Subject: [PATCH] fix(citation-panel): reset expanded state when chunkId changes CitationPanelContent uses a single instance across different citations (RightPanel.tsx:251 renders without a key), so when the user clicks a new citation while the panel is open, the prior expanded state leaks into the new citation. The reset effect had an empty dependency array, so it only fired on mount. Add chunkId to the effect deps so the expanded state resets each time the citation changes. --- surfsense_web/components/citation-panel/citation-panel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/surfsense_web/components/citation-panel/citation-panel.tsx b/surfsense_web/components/citation-panel/citation-panel.tsx index ed8acd656..4c7baab50 100644 --- a/surfsense_web/components/citation-panel/citation-panel.tsx +++ b/surfsense_web/components/citation-panel/citation-panel.tsx @@ -32,7 +32,7 @@ export const CitationPanelContent: FC = ({ chunkId, o useEffect(() => { setExpanded(false); - }, []); + }, [chunkId]); const chunkWindow = expanded ? EXPANDED_CHUNK_WINDOW : DEFAULT_CHUNK_WINDOW;