From 5a11447f0e11fc3ce1c32f71e9048b5a93e1a062 Mon Sep 17 00:00:00 2001
From: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
Date: Sun, 17 May 2026 20:39:49 -0700
Subject: [PATCH] fix: keep conflict review tree visible (#2210)
---
.../editor/ConflictComponents.test.tsx | 2 +
.../components/editor/ConflictComponents.tsx | 64 ++++++-----
.../editor/ConflictReviewFileTree.tsx | 10 +-
.../components/editor/EditorContent.test.tsx | 3 +
.../src/components/editor/EditorContent.tsx | 101 ++++++++++++++++-
.../src/components/editor/EditorPanel.tsx | 53 ++++++---
.../components/editor/EditorPanelShell.tsx | 9 ++
.../editor/useEditorPanelContentState.ts | 45 +++++---
src/renderer/src/store/slices/editor.test.ts | 41 +++++++
src/renderer/src/store/slices/editor.ts | 106 ++++++++++++++++++
10 files changed, 373 insertions(+), 61 deletions(-)
diff --git a/src/renderer/src/components/editor/ConflictComponents.test.tsx b/src/renderer/src/components/editor/ConflictComponents.test.tsx
index db178603e..0bca618c0 100644
--- a/src/renderer/src/components/editor/ConflictComponents.test.tsx
+++ b/src/renderer/src/components/editor/ConflictComponents.test.tsx
@@ -56,6 +56,8 @@ describe('ConflictReviewPanel', () => {
createLiveEntry('src/renderer/src/store/slices/linear.ts')
]}
onOpenEntry={vi.fn()}
+ selectedFile={null}
+ selectedContent={null}
onDismiss={vi.fn()}
onRefreshSnapshot={vi.fn()}
onReturnToSourceControl={vi.fn()}
diff --git a/src/renderer/src/components/editor/ConflictComponents.tsx b/src/renderer/src/components/editor/ConflictComponents.tsx
index 6c962909c..b2d00ad65 100644
--- a/src/renderer/src/components/editor/ConflictComponents.tsx
+++ b/src/renderer/src/components/editor/ConflictComponents.tsx
@@ -108,6 +108,8 @@ export function ConflictReviewPanel({
file,
liveEntries,
onOpenEntry,
+ selectedFile,
+ selectedContent,
onDismiss,
onRefreshSnapshot,
onReturnToSourceControl
@@ -115,6 +117,8 @@ export function ConflictReviewPanel({
file: OpenFile
liveEntries: GitStatusEntry[]
onOpenEntry: (entry: GitStatusEntry) => void
+ selectedFile: OpenFile | null
+ selectedContent: React.ReactNode
onDismiss: () => void
onRefreshSnapshot: () => void
onReturnToSourceControl: () => void
@@ -177,6 +181,7 @@ export function ConflictReviewPanel({
entries={treeEntries}
collapsed={fileTreeCollapsed}
onCollapsedChange={setFileTreeCollapsed}
+ selectedPath={selectedFile?.relativePath ?? null}
onOpenEntry={onOpenEntry}
/>
@@ -214,33 +219,42 @@ export function ConflictReviewPanel({
Refresh
-
-
-
-
-
-
- Select a conflict from the file tree
-
-
- Open each unresolved file, edit the conflict markers, then refresh this snapshot.
-
- {resolvedCount > 0 && (
-
- {resolvedCount} conflict{resolvedCount === 1 ? '' : 's'} no longer live in Git.
+
+ {selectedContent ?? (
+
+
+
+
+
+
+ Select a conflict from the file tree
+
+
+ Open each unresolved file, edit the conflict markers, then refresh this snapshot.
+
+ {resolvedCount > 0 && (
+
+ {resolvedCount} conflict{resolvedCount === 1 ? '' : 's'} no longer live in Git.
+
+ )}
+
+
+
+
- )}
-
-
-
-
+ )}
diff --git a/src/renderer/src/components/editor/ConflictReviewFileTree.tsx b/src/renderer/src/components/editor/ConflictReviewFileTree.tsx
index ac4975f5f..5da636fc3 100644
--- a/src/renderer/src/components/editor/ConflictReviewFileTree.tsx
+++ b/src/renderer/src/components/editor/ConflictReviewFileTree.tsx
@@ -36,11 +36,13 @@ export function ConflictReviewFileTree({
entries,
collapsed,
onCollapsedChange,
+ selectedPath,
onOpenEntry
}: {
entries: readonly ConflictReviewTreeEntry[]
collapsed: boolean
onCollapsedChange: (collapsed: boolean) => void
+ selectedPath: string | null
onOpenEntry: (entry: GitStatusEntry) => void
}): React.JSX.Element | null {
const [collapsedDirectoryKeys, setCollapsedDirectoryKeys] = React.useState
>(
@@ -96,6 +98,7 @@ export function ConflictReviewFileTree({
key={node.key}
node={node}
isCollapsed={collapsedDirectoryKeys.has(node.key)}
+ isSelected={node.type === 'file' && node.entry.path === selectedPath}
onToggleDirectory={toggleDirectory}
onOpenEntry={onOpenEntry}
/>
@@ -109,11 +112,13 @@ export function ConflictReviewFileTree({
function ConflictReviewFileTreeRow({
node,
isCollapsed,
+ isSelected,
onToggleDirectory,
onOpenEntry
}: {
node: ConflictReviewTreeNode
isCollapsed: boolean
+ isSelected: boolean
onToggleDirectory: (key: string) => void
onOpenEntry: (entry: GitStatusEntry) => void
}): React.JSX.Element {
@@ -151,7 +156,10 @@ function ConflictReviewFileTreeRow({
return (