From b886b6bf83e8a1f886deb53a6abdf411b7f18404 Mon Sep 17 00:00:00 2001 From: iliya Date: Sun, 15 Mar 2026 08:24:00 +0200 Subject: [PATCH] feat: optimize file content resolution and enhance loading state handling - Added a fast path in FileContentResolver to skip history lookup for files created by the agent with empty original content. - Improved loading state in FileSectionDiff to display a loading message and snippet preview when applicable. - Adjusted header content class names in ClaudeLogsSection and button styles in CollapsibleTeamSection for better UI consistency. - Refactored ContinuousScrollView to streamline rendering logic for file sections based on content availability. --- src/main/services/team/FileContentResolver.ts | 13 ++++++ .../components/team/ClaudeLogsSection.tsx | 2 +- .../team/CollapsibleTeamSection.tsx | 2 +- .../team/review/ContinuousScrollView.tsx | 42 +++++++++---------- .../team/review/FileSectionDiff.tsx | 15 ++++++- 5 files changed, 48 insertions(+), 26 deletions(-) diff --git a/src/main/services/team/FileContentResolver.ts b/src/main/services/team/FileContentResolver.ts index 58474949..0795b417 100644 --- a/src/main/services/team/FileContentResolver.ts +++ b/src/main/services/team/FileContentResolver.ts @@ -74,6 +74,19 @@ export class FileContentResolver { logger.debug(`Файл недоступен на диске: ${filePath}`); } + // Fast path: if the agent created the file and it still exists on disk, + // the original content is definitely empty, so skip expensive history lookup. + const hasWriteNew = snippets.some((s) => !s.isError && s.type === 'write-new'); + if (hasWriteNew && currentContent !== null) { + const result = { + original: '', + modified: currentContent, + source: 'snippet-reconstruction' as const, + }; + this.cacheResult(cacheKey, result); + return result; + } + // Strategy 1: Try file-history backup const historyResult = await this.tryFileHistoryBackup(teamName, memberName, filePath); if (historyResult) { diff --git a/src/renderer/components/team/ClaudeLogsSection.tsx b/src/renderer/components/team/ClaudeLogsSection.tsx index e8dfa2c0..a6ceb73e 100644 --- a/src/renderer/components/team/ClaudeLogsSection.tsx +++ b/src/renderer/components/team/ClaudeLogsSection.tsx @@ -123,7 +123,7 @@ export const ClaudeLogsSection = ({ ) : undefined } - headerContentClassName={isSidebar ? 'flex-wrap items-center gap-y-1 py-1 pr-3' : 'pr-3'} + headerContentClassName={isSidebar ? 'flex-wrap items-center gap-y-1 py-1 pr-1' : 'pr-1'} headerExtra={sectionHeaderExtra} defaultOpen={false} contentClassName="pt-0 [overflow-anchor:none]" diff --git a/src/renderer/components/team/CollapsibleTeamSection.tsx b/src/renderer/components/team/CollapsibleTeamSection.tsx index 82743da9..2cd656ee 100644 --- a/src/renderer/components/team/CollapsibleTeamSection.tsx +++ b/src/renderer/components/team/CollapsibleTeamSection.tsx @@ -85,7 +85,7 @@ export const CollapsibleTeamSection = ({ >