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

Diff for: src/leetCodeExplorer.ts

+1-3
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)