Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(inbox): prevent comment highlight from re-triggering on every timeline change (#374)
Bohan Jiang978e81a2683b
diff --git a/apps/web/features/issues/components/issue-detail.tsx b/apps/web/features/issues/components/issue-detail.tsxindex e986e63a8c..4343a2ba9e 100644--- a/apps/web/features/issues/components/issue-detail.tsx+++ b/apps/web/features/issues/components/issue-detail.tsx@@ -198,6 +198,7 @@ export function IssueDetail({ issueId, onDelete, defaultSidebarOpen = true, layoconst scrollContainerRef = useRef<HTMLDivElement>(null);const [showScrollBottom, setShowScrollBottom] = useState(false);const [highlightedId, setHighlightedId] = useState<string | null>(null);+ const didHighlightRef = useRef<string | null>(null);// Single source of truth: read issue directly from global storeconst issue = useIssueStore((s) => s.issues.find((i) => i.id === id)) ?? null;@@ -239,17 +240,16 @@ export function IssueDetail({ issueId, onDelete, defaultSidebarOpen = true, layoconst loading = issueLoading;- // Scroll to highlighted comment once timeline loads+ // Scroll to highlighted comment once timeline loads (fire only once per highlightCommentId)useEffect(() => {if (!highlightCommentId || timeline.length === 0) return;- // Find the comment element — could be a top-level comment or a reply+ if (didHighlightRef.current === highlightCommentId) return;const el = document.getElementById(`comment-${highlightCommentId}`);if (el) {- // Small delay to ensure layout is settled+ didHighlightRef.current = highlightCommentId;requestAnimationFrame(() => {el.scrollIntoView({ behavior: "smooth", block: "center" });setHighlightedId(highlightCommentId);- // Clear highlight after animationconst timer = setTimeout(() => setHighlightedId(null), 2000);return () => clearTimeout(timer);});