Skip to content

Commit 8024c3d

Browse files
committed
fix the bug that explorer has duplicate nodes
1 parent 7d619b3 commit 8024c3d

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/leetCodeExplorer.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ export class LeetCodeTreeDataProvider implements vscode.TreeDataProvider<LeetCod
4141
constructor(private context: vscode.ExtensionContext, private channel: vscode.OutputChannel) { }
4242

4343
public async refresh(): Promise<void> {
44-
this.treeData.clear();
4544
await this.getProblemData();
4645
this.onDidChangeTreeDataEvent.fire();
4746
}
@@ -100,14 +99,14 @@ export class LeetCodeTreeDataProvider implements vscode.TreeDataProvider<LeetCod
10099

101100
private async getProblemData(): Promise<void> {
102101
const allProblems: list.IProblem[] = await list.listProblems(this.channel);
102+
this.treeData.clear();
103103
for (const problem of allProblems) {
104104
const problems: list.IProblem[] | undefined = this.treeData.get(problem.difficulty);
105105
if (problems) {
106106
problems.push(problem);
107107
} else {
108108
this.treeData.set(problem.difficulty, [problem]);
109109
}
110-
111110
}
112111
}
113112

@@ -156,5 +155,4 @@ export class LeetCodeTreeDataProvider implements vscode.TreeDataProvider<LeetCod
156155
});
157156
return difficultynodes;
158157
}
159-
160158
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy