@@ -179,7 +179,6 @@ export class ScmHistoryWidget extends ScmNavigableListWidget<ScmHistoryListNode>
179
179
}
180
180
181
181
protected async addCommits ( options ?: HistoryWidgetOptions ) : Promise < void > {
182
- // const repository: Repository | undefined = this.repositoryProvider.findRepositoryOrSelected(options);
183
182
const repository = this . scmService . selectedRepository ;
184
183
185
184
this . cancelIndicator . cancel ( ) ;
@@ -189,19 +188,17 @@ export class ScmHistoryWidget extends ScmNavigableListWidget<ScmHistoryListNode>
189
188
if ( repository ) {
190
189
if ( this . historySupport ) {
191
190
try {
192
- const currentCommits = this . status . state === 'ready' ? this . status . commits : [ ] ;
193
-
194
- let history = await this . historySupport . getCommitHistory ( options ) ;
191
+ const history = await this . historySupport . getCommitHistory ( options ) ;
195
192
if ( token . isCancellationRequested || ! this . hasMoreCommits ) {
196
193
return ;
197
194
}
198
195
199
- if ( options && ( ( options . maxCount && history . length < options . maxCount ) || ( ! options . maxCount && currentCommits ) ) ) {
196
+ if ( options && ( options . maxCount && history . length < options . maxCount ) ) {
200
197
this . hasMoreCommits = false ;
201
198
}
202
- if ( currentCommits . length > 0 ) {
203
- history = history . slice ( 1 ) ;
204
- }
199
+
200
+ const avatarCache = new Map < string , string > ( ) ;
201
+
205
202
const commits : ScmCommitNode [ ] = [ ] ;
206
203
for ( const commit of history ) {
207
204
const fileChangeNodes : ScmFileChangeNode [ ] = [ ] ;
@@ -211,7 +208,14 @@ export class ScmHistoryWidget extends ScmNavigableListWidget<ScmHistoryListNode>
211
208
} ) ;
212
209
} ) ) ;
213
210
214
- const avatarUrl = await this . avatarService . getAvatar ( commit . authorEmail ) ;
211
+ let avatarUrl = '' ;
212
+ if ( avatarCache . has ( commit . authorEmail ) ) {
213
+ avatarUrl = avatarCache . get ( commit . authorEmail ) ! ;
214
+ } else {
215
+ avatarUrl = await this . avatarService . getAvatar ( commit . authorEmail ) ;
216
+ avatarCache . set ( commit . authorEmail , avatarUrl ) ;
217
+ }
218
+
215
219
commits . push ( {
216
220
commitDetails : commit ,
217
221
authorAvatar : avatarUrl ,
@@ -220,8 +224,7 @@ export class ScmHistoryWidget extends ScmNavigableListWidget<ScmHistoryListNode>
220
224
selected : false
221
225
} ) ;
222
226
}
223
- currentCommits . push ( ...commits ) ;
224
- this . status = { state : 'ready' , commits : currentCommits } ;
227
+ this . status = { state : 'ready' , commits } ;
225
228
} catch ( error ) {
226
229
if ( options && options . uri && repository ) {
227
230
this . hasMoreCommits = false ;
0 commit comments