Skip to content

Commit fd96ed0

Browse files
authored
Fix load more and duplicate issues (#8066)
1 parent 670ad96 commit fd96ed0

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/github/folderRepositoryManager.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,13 @@ export class FolderRepositoryManager extends Disposable {
10821082
}
10831083
};
10841084

1085+
const activeGitHubRemotes = await this.getActiveGitHubRemotes(this._allGitHubRemotes);
1086+
10851087
const githubRepositories = this._githubRepositories.filter(repo => {
1088+
if (!activeGitHubRemotes.find(r => r.equals(repo.remote))) {
1089+
return false;
1090+
}
1091+
10861092
const info = this._repositoryPageInformation.get(repo.remote.url.toString() + queryId);
10871093
// If we are in case 1 or 3, don't filter out repos that are out of pages, as we will be querying from the start.
10881094
return info && (options.fetchNextPage === false || info.hasMorePages !== false);

src/view/prsTreeModel.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,9 @@ export class PrsTreeModel extends Disposable {
355355
try {
356356
let maxKnownPR: number | undefined;
357357
const cache = this.getFolderCache(folderRepoManager);
358+
const cachedPRs = cache.get(query)!;
358359
if (!fetchNextPage && cache.has(query)) {
359360
const shouldRefresh = await this._testIfRefreshNeeded(cache.get(query)!, query, folderRepoManager);
360-
const cachedPRs = cache.get(query)!;
361361
maxKnownPR = cachedPRs.maxKnownPR;
362362
if (!shouldRefresh) {
363363
cachedPRs.clearRequested = false;
@@ -377,6 +377,9 @@ export class PrsTreeModel extends Disposable {
377377
{ fetchNextPage, fetchOnePagePerRepo },
378378
query,
379379
);
380+
if (fetchNextPage) {
381+
prs.items = cachedPRs?.items.items.concat(prs.items) ?? prs.items;
382+
}
380383
cache.set(query, { clearRequested: false, items: prs, maxKnownPR });
381384
prs.items.forEach(pr => this._allCachedPRs.add(pr));
382385

@@ -404,6 +407,9 @@ export class PrsTreeModel extends Disposable {
404407
PRType.All,
405408
{ fetchNextPage }
406409
);
410+
if (fetchNextPage) {
411+
prs.items = allCache?.items.items.concat(prs.items) ?? prs.items;
412+
}
407413
cache.set(PRType.All, { clearRequested: false, items: prs, maxKnownPR: undefined });
408414
prs.items.forEach(pr => this._allCachedPRs.add(pr));
409415

0 commit comments

Comments
 (0)