File tree Expand file tree Collapse file tree
crates/tauri-app/frontend/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ export function App() {
7575 const hasSidePane = ( ) => {
7676 const tab = store . activeTab ;
7777 const browserOpen = tab && store . threadBrowserOpen [ tab ] ;
78- const diffOpen = store . diffPanelOpen && isGitProject ( ) ;
78+ const diffOpen = store . activeTab && store . threadDiffOpen [ store . activeTab ] && isGitProject ( ) ;
7979 return browserOpen || diffOpen ;
8080 } ;
8181
@@ -147,7 +147,7 @@ export function App() {
147147 }
148148 if ( mod && e . shiftKey && key === "d" ) {
149149 e . preventDefault ( ) ;
150- setStore ( "diffPanelOpen " , ! store . diffPanelOpen ) ;
150+ if ( store . activeTab ) setStore ( "threadDiffOpen " , store . activeTab , ! store . threadDiffOpen [ store . activeTab ] ) ;
151151 }
152152 }
153153
@@ -204,7 +204,7 @@ export function App() {
204204 < Show when = { store . activeTab && store . threadBrowserOpen [ store . activeTab ! ] } >
205205 < BrowserPanel threadId = { store . activeTab ! } />
206206 </ Show >
207- < Show when = { store . diffPanelOpen && diffCwd ( ) } >
207+ < Show when = { store . activeTab && store . threadDiffOpen [ store . activeTab ! ] && diffCwd ( ) } >
208208 < DiffEditor cwd = { diffCwd ( ) } prNumber = { activePrNumber ( ) } />
209209 </ Show >
210210 </ div >
Original file line number Diff line number Diff line change @@ -153,7 +153,10 @@ export function ThreadToolbar() {
153153 const tab = activeTab ( ) ;
154154 return tab ? ! ! store . threadBrowserOpen [ tab ] : false ;
155155 } ;
156- const diffOpen = ( ) => store . diffPanelOpen ;
156+ const diffOpen = ( ) => {
157+ const tab = activeTab ( ) ;
158+ return tab ? ! ! store . threadDiffOpen [ tab ] : false ;
159+ } ;
157160
158161 // Only show diff for git-activated projects (path !== ".")
159162 const isGitProject = ( ) => {
@@ -171,7 +174,8 @@ export function ThreadToolbar() {
171174 }
172175
173176 function toggleDiff ( ) {
174- setStore ( "diffPanelOpen" , ! store . diffPanelOpen ) ;
177+ const tab = activeTab ( ) ;
178+ if ( tab ) setStore ( "threadDiffOpen" , tab , ! store . threadDiffOpen [ tab ] ) ;
175179 }
176180
177181 function exportChat ( ) {
Original file line number Diff line number Diff line change @@ -36,7 +36,8 @@ export function DiffEditor(props: { cwd: string; prNumber?: number | null }) {
3636 const [ gitPanelOpen , setGitPanelOpen ] = createSignal ( true ) ;
3737
3838 function close ( ) {
39- setStore ( "diffPanelOpen" , false ) ;
39+ const tab = appStore . store . activeTab ;
40+ if ( tab ) setStore ( "threadDiffOpen" , tab , false ) ;
4041 }
4142
4243 // Cache diffs per cwd to avoid re-fetching on thread switch
Original file line number Diff line number Diff line change @@ -70,7 +70,8 @@ export function TabBar() {
7070 }
7171
7272 function toggleDiff ( ) {
73- setStore ( "diffPanelOpen" , ! store . diffPanelOpen ) ;
73+ const tab = store . activeTab ;
74+ if ( tab ) setStore ( "threadDiffOpen" , tab , ! store . threadDiffOpen [ tab ] ) ;
7475 }
7576
7677 function exportChat ( ) {
@@ -126,7 +127,7 @@ export function TabBar() {
126127 </ button >
127128 < button
128129 class = "tb-action"
129- classList = { { active : store . diffPanelOpen } }
130+ classList = { { active : ! ! ( store . activeTab && store . threadDiffOpen [ store . activeTab ] ) } }
130131 onClick = { toggleDiff }
131132 title = "Diff view (Cmd+Shift+D)"
132133 >
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ export interface AppStore {
3333 themeOpen : boolean ;
3434 worktrees : Record < string , { thread_id : string ; branch : string ; path : string ; active : boolean } | undefined > ;
3535 splitTab : string | null ;
36- diffPanelOpen : boolean ;
36+ threadDiffOpen : Record < string , boolean > ;
3737 selectedModel : string | null ;
3838 threadBrowserOpen : Record < string , boolean > ;
3939 threadBrowserUrls : Record < string , string > ;
@@ -72,7 +72,7 @@ function createAppStore() {
7272 themeOpen : false ,
7373 worktrees : { } ,
7474 splitTab : null ,
75- diffPanelOpen : false ,
75+ threadDiffOpen : { } ,
7676 selectedModel : null ,
7777 threadBrowserOpen : { } ,
7878 threadBrowserUrls : { } ,
You can’t perform that action at this time.
0 commit comments