File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
55 "version" : " 0.2.0" ,
66 "configurations" : [
7+ {
8+ "name" : " dashboard" ,
9+ "cwd" : " dashboard" ,
10+ "request" : " launch" ,
11+ "flutterMode" : " debug" ,
12+ "deviceId" : " chrome" ,
13+ "type" : " dart" ,
14+ "args" : [
15+ " --web-port" ,
16+ " 8080" ,
17+ ]
18+ },
719 {
820 "name" : " dashboard (fake auth)" ,
921 "cwd" : " dashboard" ,
1224 "deviceId" : " chrome" ,
1325 "type" : " dart" ,
1426 "args" : [
15- " --dart-define=FAKE_AUTH=true"
27+ " --dart-define=FAKE_AUTH=true" ,
28+ " --web-port" ,
29+ " 8080" ,
1630 ]
1731 },
1832 ]
Original file line number Diff line number Diff line change @@ -336,6 +336,10 @@ class PresubmitState extends ChangeNotifier {
336336 _lastFetchedSha = null ;
337337 _jobs = null ;
338338 _selectedJob = null ;
339+ // Reset to force re-fetch of available SHAs and pick the latest one
340+ if (sha == null ) {
341+ _lastFetchedPr = null ;
342+ }
339343 }
340344
341345 if (changed) {
Original file line number Diff line number Diff line change @@ -367,4 +367,41 @@ void main() {
367367 ),
368368 ).called (1 );
369369 });
370+ test (
371+ 'syncUpdate with null sha resets _lastFetchedPr to force re-fetch when pr is the same' ,
372+ () async {
373+ const summaries = [
374+ PresubmitGuardSummary (
375+ headSha: 'latest' ,
376+ creationTime: 123 ,
377+ guardStatus: GuardStatus .succeeded,
378+ ),
379+ ];
380+ when (
381+ mockCocoonService.fetchPresubmitGuardSummaries (
382+ pr: '123' ,
383+ repo: 'flutter' ,
384+ ),
385+ ).thenAnswer (
386+ (_) async =>
387+ const CocoonResponse <List <PresubmitGuardSummary >>.data (summaries),
388+ );
389+
390+ presubmitState.update (repo: 'flutter' , pr: '123' , sha: 'sha1' );
391+ expect (presubmitState.sha, 'sha1' );
392+
393+ await Future <void >.delayed (Duration .zero);
394+ clearInteractions (mockCocoonService);
395+
396+ presubmitState.update (pr: '123' , sha: null );
397+
398+ verify (
399+ mockCocoonService.fetchPresubmitGuardSummaries (
400+ pr: '123' ,
401+ repo: 'flutter' ,
402+ ),
403+ ).called (1 );
404+ expect (presubmitState.sha, 'latest' );
405+ },
406+ );
370407}
You can’t perform that action at this time.
0 commit comments