This commit is contained in:
Abhay Singh 2026-08-04 22:42:56 -07:00 • committed by GitHub
commit fd08079ee4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -92,8 +92,12 @@ export function HighlightsCard({
if (isReplyOpen) replyInputRef.current?.focus()
}, [isReplyOpen])
// biome-ignore lint/correctness/useExhaustiveDependencies: intentionally re-run when items changes
useEffect(() => {
// The Daily Brief refreshes on its own every few hours, so items can be
// replaced with a shorter list while the user is on a later page. Pull the
// active index back into range, otherwise currentItem is undefined and the
// card falls through to the empty state even though highlights exist.
setActiveIndex((i) => Math.min(i, Math.max(items.length - 1, 0)))
setIsReplyOpen(false)
setReplyText("")
setIsExpanded(false)