@@ -96,6 +96,7 @@ export default class RootController extends React.Component {
96
96
this . refGitTabController = new RefHolder ( ) ;
97
97
this . refGitTabWrapperController = new RefHolder ( ) ;
98
98
this . refGitHubTabController = new RefHolder ( ) ;
99
+ this . filePatchRefs = new Map ( ) ;
99
100
100
101
this . gitTabTracker = new TabTracker ( 'git' , {
101
102
uri : 'atom-github://dock-item/git' ,
@@ -309,13 +310,21 @@ export default class RootController extends React.Component {
309
310
return this . props . filePatchItems . map ( item => {
310
311
const { filePath, stagingStatus, workdir} = getPropsFromUri ( item . uri ) ;
311
312
313
+ let refHolder = this . filePatchRefs . get ( item . uri ) ;
314
+ if ( ! refHolder ) {
315
+ refHolder = new RefHolder ( ) ;
316
+ this . filePatchRefs . set ( refHolder ) ;
317
+ }
318
+
312
319
return (
313
320
< PaneItem
314
321
key = { item . key }
315
322
workspace = { this . props . workspace }
316
323
onDidCloseItem = { this . removeFilePatchItem }
317
- stubItem = { item } >
324
+ stubItem = { item }
325
+ itemHolder = { refHolder } >
318
326
< FilePatchController
327
+ ref = { refHolder . setter }
319
328
deserializers = { this . props . deserializers }
320
329
commandRegistry = { this . props . commandRegistry }
321
330
tooltips = { this . props . tooltips }
@@ -366,6 +375,14 @@ export default class RootController extends React.Component {
366
375
this . props . repository . onMergeError ( ( ) => this . gitTabTracker . ensureVisible ( ) ) ,
367
376
this . refGitTabWrapperController . observe ( c => this . refGitTabController . setter ( c . getWrappedComponentInstance ( ) ) ) ,
368
377
) ;
378
+
379
+ const existingURIs = new Set ( this . props . filePatchItems . map ( item => item . uri ) ) ;
380
+ const retainedURIs = [ ...this . filePatchRefs . keys ( ) ] ;
381
+ for ( const uri of retainedURIs ) {
382
+ if ( ! existingURIs . has ( uri ) ) {
383
+ this . filePatchRefs . delete ( uri ) ;
384
+ }
385
+ }
369
386
}
370
387
371
388
onConsumeStatusBar ( statusBar ) {
0 commit comments