@@ -68,6 +68,7 @@ export class IssueModel<TItem extends Issue = Issue> extends Disposable {
6868 private _lastCheckedForUpdatesAt ?: Date ;
6969
7070 private _timelineEvents : readonly TimelineEvent [ ] | undefined ;
71+ private _copilotTimelineEvents : TimelineEvent [ ] | undefined ;
7172
7273 protected _onDidChange = this . _register ( new vscode . EventEmitter < IssueChangeEvent > ( ) ) ;
7374 public onDidChange = this . _onDidChange . event ;
@@ -514,13 +515,19 @@ export class IssueModel<TItem extends Issue = Issue> extends Disposable {
514515 /**
515516 * TODO: @alexr00 we should delete this https://github.com/microsoft/vscode-pull-request-github/issues/6965
516517 */
517- async getCopilotTimelineEvents ( issueModel : IssueModel , skipMerge : boolean = false ) : Promise < TimelineEvent [ ] > {
518+ async getCopilotTimelineEvents ( issueModel : IssueModel , skipMerge : boolean = false , useCache : boolean = false ) : Promise < TimelineEvent [ ] > {
518519 if ( ! COPILOT_ACCOUNTS [ issueModel . author . login ] ) {
519520 return [ ] ;
520521 }
521522
522523 Logger . debug ( `Fetch Copilot timeline events of issue #${ issueModel . number } - enter` , GitHubRepository . ID ) ;
523524
525+ if ( useCache && this . _copilotTimelineEvents ) {
526+ Logger . debug ( `Fetch Copilot timeline events of issue #${ issueModel . number } (used cache) - exit` , GitHubRepository . ID ) ;
527+
528+ return this . _copilotTimelineEvents ;
529+ }
530+
524531 const { octokit, remote } = await this . githubRepository . ensure ( ) ;
525532 try {
526533 const timeline = await restPaginate < typeof octokit . api . issues . listEventsForTimeline , OctokitCommon . ListEventsForTimelineResponse > ( octokit . api . issues . listEventsForTimeline , {
@@ -531,6 +538,7 @@ export class IssueModel<TItem extends Issue = Issue> extends Disposable {
531538 } ) ;
532539
533540 const timelineEvents = parseSelectRestTimelineEvents ( issueModel , timeline ) ;
541+ this . _copilotTimelineEvents = timelineEvents ;
534542 if ( timelineEvents . length === 0 ) {
535543 return [ ] ;
536544 }
0 commit comments