From c541ca8032bab595e812adbf0e0c8bb399875579 Mon Sep 17 00:00:00 2001 From: archivr-qa Date: Mon, 24 Aug 2026 15:51:53 +0200 Subject: [PATCH] fix: guard summary callbacks during entry render --- frontend/src/components/ContextRail.jsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/ContextRail.jsx b/frontend/src/components/ContextRail.jsx index 6f466d6..9d6bad2 100644 --- a/frontend/src/components/ContextRail.jsx +++ b/frontend/src/components/ContextRail.jsx @@ -77,6 +77,12 @@ export default function ContextRail({ archiveId, selectedEntry, selectedUids, se const summaryPollAbortRef = useRef(null) const summaryGenerateAbortRef = useRef(null) const summarySelectionRef = useRef(null) + // Update before effects run so a request settled during a new selection's + // render can never apply state or refresh the newly selected entry. + const summarySelectionKey = archiveId && detail?.summary?.entry_uid + ? `${archiveId}:${detail.summary.entry_uid}` + : null + summarySelectionRef.current = summarySelectionKey // ── Bulk-panel state ──────────────────────────────────────────────────── const isBulk = selectedUids?.size >= 2 @@ -131,10 +137,6 @@ export default function ContextRail({ archiveId, selectedEntry, selectedUids, se // Seed the summary from the entry detail payload and stop any poll left over // from the previously selected entry. useLayoutEffect(() => { - const selectionKey = archiveId && detail?.summary?.entry_uid - ? `${archiveId}:${detail.summary.entry_uid}` - : null - summarySelectionRef.current = selectionKey clearInterval(summaryPollRef.current) summaryPollRef.current = null summaryPollAbortRef.current?.abort()