diff --git a/src/renderer/components/team/review/FileSectionDiff.tsx b/src/renderer/components/team/review/FileSectionDiff.tsx index 701c3b68..867d2347 100644 --- a/src/renderer/components/team/review/FileSectionDiff.tsx +++ b/src/renderer/components/team/review/FileSectionDiff.tsx @@ -89,8 +89,9 @@ export const FileSectionDiff = ({ return writeSnippets[writeSnippets.length - 1].newString; })(); - const hasCodeMirrorContent = - fileContent && fileContent.contentSource !== 'unavailable' && resolvedModified !== null; + // Show CodeMirror whenever we have resolved modified content (including new files + // where contentSource may be 'unavailable' but write-new snippet provides the content) + const hasCodeMirrorContent = resolvedModified !== null; if (!hasCodeMirrorContent) { return ( @@ -105,12 +106,12 @@ export const FileSectionDiff = ({
{ return (
- {/* Заголовок файла */} -
- {file.relativePath} - {file.isNewFile && ( - - NEW - - )} - - {nonErrorSnippets.length} change{nonErrorSnippets.length !== 1 ? 's' : ''} - -
- {/* Snippets */} {nonErrorSnippets.map((snippet, index) => ( diff --git a/src/renderer/store/slices/editorSlice.ts b/src/renderer/store/slices/editorSlice.ts index b5b8888d..1dde315a 100644 --- a/src/renderer/store/slices/editorSlice.ts +++ b/src/renderer/store/slices/editorSlice.ts @@ -860,7 +860,26 @@ async function refreshDirectory( try { const result = await api.editor.readDir(dirPath); const currentTree = get().editorFileTree; - if (currentTree) { + if (!currentTree) return; + + const projectPath = get().editorProjectPath; + if (dirPath === projectPath) { + // Root refresh — tree IS the root's children, so preserve expanded subtrees + // by merging new entries with existing children data + const existingByPath = new Map(); + for (const entry of currentTree) { + existingByPath.set(entry.path, entry); + } + const merged = result.entries.map((entry) => { + const existing = existingByPath.get(entry.path); + // Preserve expanded subtree children for directories that still exist + if (existing?.children && entry.type === 'directory') { + return { ...entry, children: existing.children }; + } + return entry; + }); + set({ editorFileTree: merged }); + } else { const updatedTree = mergeChildrenIntoTree(currentTree, dirPath, result.entries); set({ editorFileTree: updatedTree }); }