@@ -36,7 +36,6 @@ export interface IGitSessionNodeState {
36
36
unstagedFiles : Git . IStatusFileResult [ ] ;
37
37
untrackedFiles : Git . IStatusFileResult [ ] ;
38
38
39
- isHistoryVisible : boolean ;
40
39
tab : number ;
41
40
}
42
41
@@ -62,7 +61,6 @@ export class GitPanel extends React.Component<
62
61
stagedFiles : [ ] ,
63
62
unstagedFiles : [ ] ,
64
63
untrackedFiles : [ ] ,
65
- isHistoryVisible : false ,
66
64
tab : 0
67
65
} ;
68
66
@@ -77,7 +75,7 @@ export class GitPanel extends React.Component<
77
75
} , this ) ;
78
76
props . model . headChanged . connect ( async ( ) => {
79
77
await this . refreshBranch ( ) ;
80
- if ( this . state . isHistoryVisible ) {
78
+ if ( this . state . tab === 1 ) {
81
79
this . refreshHistory ( ) ;
82
80
} else {
83
81
this . refreshStatus ( ) ;
@@ -233,9 +231,7 @@ export class GitPanel extends React.Component<
233
231
return (
234
232
< React . Fragment >
235
233
{ this . _renderTabs ( ) }
236
- { this . state . isHistoryVisible
237
- ? this . _renderHistory ( )
238
- : this . _renderChanges ( ) }
234
+ { this . state . tab === 1 ? this . _renderHistory ( ) : this . _renderChanges ( ) }
239
235
</ React . Fragment >
240
236
) ;
241
237
}
@@ -321,7 +317,7 @@ export class GitPanel extends React.Component<
321
317
private _renderHistory ( ) {
322
318
return (
323
319
< HistorySideBar
324
- isExpanded = { this . state . isHistoryVisible }
320
+ isExpanded = { this . state . tab === 1 }
325
321
branches = { this . state . branches }
326
322
pastCommits = { this . state . pastCommits }
327
323
model = { this . props . model }
@@ -358,16 +354,11 @@ export class GitPanel extends React.Component<
358
354
* @param tab - tab number
359
355
*/
360
356
private _onTabChange = ( event : any , tab : number ) : void => {
361
- let isHistoryVisible ;
362
357
if ( tab === 1 ) {
363
358
this . refreshHistory ( ) ;
364
- isHistoryVisible = true ;
365
- } else {
366
- isHistoryVisible = false ;
367
359
}
368
360
this . setState ( {
369
- tab : tab ,
370
- isHistoryVisible : isHistoryVisible
361
+ tab : tab
371
362
} ) ;
372
363
} ;
373
364
@@ -378,7 +369,7 @@ export class GitPanel extends React.Component<
378
369
*/
379
370
private _onRefresh = async ( ) => {
380
371
await this . refreshBranch ( ) ;
381
- if ( this . state . isHistoryVisible ) {
372
+ if ( this . state . tab === 1 ) {
382
373
this . refreshHistory ( ) ;
383
374
} else {
384
375
this . refreshStatus ( ) ;
0 commit comments