From a509990525fff71b448f2596f203a9df488a802e Mon Sep 17 00:00:00 2001 From: Val Alexander Date: Fri, 10 Apr 2026 09:14:40 -0500 Subject: [PATCH] Defer empty diff guard until after hook setup - Keep hook execution order stable in `InlineDiffBlock` - Return early only after derived state and effects are initialized --- apps/web/src/components/chat/InlineDiffBlock.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/chat/InlineDiffBlock.tsx b/apps/web/src/components/chat/InlineDiffBlock.tsx index e21973ebe..f1ffa3482 100644 --- a/apps/web/src/components/chat/InlineDiffBlock.tsx +++ b/apps/web/src/components/chat/InlineDiffBlock.tsx @@ -267,8 +267,6 @@ export const InlineDiffBlock = memo(function InlineDiffBlock(props: { }); }, [allLines]); - if (allLines.length === 0) return null; - const needsTruncation = allLines.length > MAX_VISIBLE_LINES; const visibleLines = needsTruncation && !isExpanded ? keyedLines.slice(0, MAX_VISIBLE_LINES) : keyedLines; @@ -328,6 +326,10 @@ export const InlineDiffBlock = memo(function InlineDiffBlock(props: { } }, [highlightedLines, languageId, diffThemeName]); + if (allLines.length === 0) { + return null; + } + return (
{/* File header */}