Skip to content

Commit 400ee4c

Browse files
wankun-tcjclaude
andcommitted
Fix refresh button not fetching latest data due to double-fire race condition
When the refresh button (pr.refreshList) was clicked, two separate _onDidChangeTreeData events fired on the same CategoryTreeNode instances: 1. forceClearCache() triggered _onDidChangeData → refreshAllQueryResults(true) 2. The pr.refreshList handler itself also called refreshAllQueryResults(true) This caused VS Code to call getChildren() twice concurrently on the same nodes. The second call's super.getChildren(true) would dispose the PR children that the first call had just populated, resulting in the tree failing to display the fresh data from GitHub. Fix: Remove _onDidChangeData.fire() from forceClearCache() to eliminate the duplicate event source, and update pr.refreshList to call refreshAllQueryResults() without the reset flag (which is a no-op anyway since forceClearCache() already empties the cache). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d82874f commit 400ee4c

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

src/view/prsTreeDataProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class PullRequestsTreeDataProvider extends Disposable implements vscode.T
6565
}));
6666
this._register(vscode.commands.registerCommand('pr.refreshList', _ => {
6767
this.prsTreeModel.forceClearCache();
68-
this.refreshAllQueryResults(true);
68+
this.refreshAllQueryResults();
6969
}));
7070

7171
this._register(vscode.commands.registerCommand('pr.loadMore', (node: CategoryTreeNode) => {

src/view/prsTreeModel.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ export class PrsTreeModel extends Disposable {
181181
public forceClearCache() {
182182
this._cachedPRs.clear();
183183
this._allCachedPRs.clear();
184-
this._onDidChangeData.fire();
185184
}
186185

187186
public hasPullRequest(pr: PullRequestModel): boolean {

0 commit comments

Comments
 (0)