@@ -4,7 +4,6 @@ import { CodeMirrorEditor } from "@features/code-editor/components/CodeMirrorEdi
44import { getRelativePath } from "@features/code-editor/utils/pathUtils" ;
55import { usePanelLayoutStore } from "@features/panels/store/panelLayoutStore" ;
66import { useCwd } from "@features/sidebar/hooks/useCwd" ;
7- import { useChangesModeStore } from "@features/task-detail/stores/changesModeStore" ;
87import { Box } from "@radix-ui/themes" ;
98import { trpcVanilla } from "@renderer/trpc/client" ;
109import type { Task } from "@shared/types" ;
@@ -29,21 +28,6 @@ export function DiffEditorPanel({
2928 ( s ) => s . closeDiffTabsForFile ,
3029 ) ;
3130
32- // Comparison mode
33- const compMode = useChangesModeStore ( ( s ) => s . mode ) ;
34- const isBranchMode = compMode === "branch" ;
35-
36- // Fetch merge-base SHA when in branch mode
37- const { data : mergeBase } = useQuery ( {
38- queryKey : [ "merge-base" , repoPath ] ,
39- queryFn : ( ) =>
40- trpcVanilla . git . getMergeBase . query ( {
41- directoryPath : repoPath as string ,
42- } ) ,
43- enabled : ! ! repoPath && isBranchMode ,
44- staleTime : 5_000 ,
45- } ) ;
46-
4731 const { data : changedFiles = [ ] , isLoading : loadingChangelist } = useQuery ( {
4832 queryKey : [ "changed-files-head" , repoPath ] ,
4933 queryFn : ( ) =>
@@ -75,24 +59,14 @@ export function DiffEditorPanel({
7559 refetchOnWindowFocus : true ,
7660 } ) ;
7761
78- // Original content: for branch mode use merge-base; otherwise HEAD
79- const originalRef = isBranchMode && mergeBase ? mergeBase : "HEAD" ;
8062 const { data : originalContent , isLoading : loadingOriginal } = useQuery ( {
81- queryKey : isBranchMode
82- ? [ "file-at-ref" , repoPath , originalPath , originalRef ]
83- : [ "file-at-head" , repoPath , originalPath ] ,
63+ queryKey : [ "file-at-head" , repoPath , originalPath ] ,
8464 queryFn : ( ) =>
85- isBranchMode
86- ? trpcVanilla . git . getFileAtRef . query ( {
87- directoryPath : repoPath as string ,
88- filePath : originalPath ,
89- ref : originalRef ,
90- } )
91- : trpcVanilla . git . getFileAtHead . query ( {
92- directoryPath : repoPath as string ,
93- filePath : originalPath ,
94- } ) ,
95- enabled : ! ! repoPath && ! isNew && ( ! isBranchMode || ! ! mergeBase ) ,
65+ trpcVanilla . git . getFileAtHead . query ( {
66+ directoryPath : repoPath as string ,
67+ filePath : originalPath ,
68+ } ) ,
69+ enabled : ! ! repoPath && ! isNew ,
9670 staleTime : 30_000 ,
9771 refetchOnWindowFocus : true ,
9872 } ) ;
@@ -103,13 +77,9 @@ export function DiffEditorPanel({
10377 queryKey : [ "repo-file" , repoPath , filePath ] ,
10478 } ) ;
10579 queryClient . invalidateQueries ( { queryKey : [ "file-at-head" , repoPath ] } ) ;
106- queryClient . invalidateQueries ( { queryKey : [ "file-at-ref" , repoPath ] } ) ;
10780 queryClient . invalidateQueries ( {
10881 queryKey : [ "changed-files-head" , repoPath ] ,
10982 } ) ;
110- queryClient . invalidateQueries ( {
111- queryKey : [ "changed-files-mode" , repoPath ] ,
112- } ) ;
11383 } , [ repoPath , filePath , queryClient ] ) ;
11484
11585 const handleContentChange = useCallback (
@@ -129,12 +99,6 @@ export function DiffEditorPanel({
12999 queryClient . invalidateQueries ( {
130100 queryKey : [ "changed-files-head" , repoPath ] ,
131101 } ) ;
132- queryClient . invalidateQueries ( {
133- queryKey : [ "changed-files-mode" , repoPath ] ,
134- } ) ;
135- queryClient . invalidateQueries ( {
136- queryKey : [ "diff-stats-mode" , repoPath ] ,
137- } ) ;
138102 } catch ( _error ) { }
139103 } ,
140104 [ repoPath , filePath , queryClient ] ,
@@ -172,9 +136,6 @@ export function DiffEditorPanel({
172136 const showDiff = ! isDeleted && ! isNew ;
173137 const content = isDeleted ? originalContent : modifiedContent ;
174138
175- // Don't allow content editing in branch mode
176- const allowContentChange = ! isBranchMode ;
177-
178139 return (
179140 < Box height = "100%" style = { { overflow : "hidden" } } >
180141 { showDiff ? (
@@ -183,7 +144,7 @@ export function DiffEditorPanel({
183144 modifiedContent = { modifiedContent ?? "" }
184145 filePath = { absolutePath }
185146 relativePath = { filePath }
186- onContentChange = { allowContentChange ? handleContentChange : undefined }
147+ onContentChange = { handleContentChange }
187148 onRefresh = { handleRefresh }
188149 />
189150 ) : (
0 commit comments