@@ -564,10 +564,16 @@ describe('register', () => {
564564 'and withdrew the pane the engine left waiting, so no resize seats it' ,
565565 ) . toEqual ( [ 'diff' ] )
566566
567+ expect (
568+ world . runs . map ( run => Fixtures . gitWordOf ( run . argv ) ) . slice ( 0 , 2 ) ,
569+ 'the repository was found and read once before the open, as the ' +
570+ 'built-in primes; nothing polls for a pane no one sees' ,
571+ ) . toEqual ( [ 'rev-parse --show-toplevel' , 'status' ] )
572+
567573 expect (
568574 world . runs . map ( run => Fixtures . gitWordOf ( run . argv ) ) ,
569- 'the repository was found, nothing fetched for a pane no one sees ' ,
570- ) . toEqual ( [ 'rev-parse --show-toplevel' ] )
575+ 'no HEAD poll for a withdrawn pane ' ,
576+ ) . not . toContain ( Fixtures . POLL_WORD )
571577
572578 isNarrow = false
573579
@@ -622,6 +628,59 @@ describe('register', () => {
622628 ) . toEqual ( [ 'diff' ] )
623629 } )
624630
631+ test ( 'a docked pane opens once its first fetch settled' , async ( $ , on ) => {
632+ const opened : string [ ] = [ ]
633+ const clock = Fixtures . startsSession ( on )
634+
635+ on ( 'process.run' , async ( $ , e ) => {
636+ if ( e . argv . includes ( '--shortstat' ) ) {
637+ await clock . sleep ( Fixtures . SLOW_DIFF_MS )
638+ }
639+
640+ return { value : Fixtures . gitIn ( e . argv ) }
641+ } )
642+
643+ on ( 'ui.open' , ( $ , e ) => {
644+ opened . push ( e . id )
645+
646+ return { value : undefined }
647+ } )
648+
649+ on ( 'ui.close' , ( ) => ( { value : undefined } ) )
650+ on ( 'ui.invalidate' , ( ) => ( { value : undefined } ) )
651+ on ( 'ui.render' , { component : 'PromptHint' } , ( ) => Fixtures . HINT_DRAWN )
652+ on ( 'session.messages' , ( ) => ( { value : [ ] } ) )
653+ on ( 'settings.read' , ( ) => ( { value : { } } ) )
654+ on ( 'tool.call' , ( ) => ( { result : 'edited' } ) )
655+ mock . store ( on )
656+ mock . env ( on , { } )
657+
658+ await $ . session . start ( Fixtures . SESSION )
659+ await $ . ui . render ( Fixtures . HINT )
660+
661+ await $ . tool . call ( {
662+ tool : 'Edit' ,
663+ file_path : '/work/app.ts' ,
664+ old_string : '1' ,
665+ new_string : '2' ,
666+ } )
667+
668+ await clock . advance ( Fixtures . SLOW_DIFF_MS - 1 )
669+
670+ expect ( opened , 'git has not answered: no pane, no Loading frame' ) . toEqual (
671+ [ ] ,
672+ )
673+
674+ await clock . advance ( Fixtures . SETTLE_MS )
675+
676+ expect ( opened , 'the fetch settled: the pane opens filled' ) . toEqual ( [ 'diff' ] )
677+
678+ const drawn = Fixtures . textOf ( await $ . ui . render ( Fixtures . PANE ) )
679+
680+ expect ( drawn ) . toContain ( '1 file changed' )
681+ expect ( drawn ) . not . toContain ( 'Loading diff' )
682+ } )
683+
625684 test ( '/clear closes the pane it finds open' , async ( $ , on ) => {
626685 const world = Fixtures . inRepository ( on )
627686
0 commit comments