Skip to content

Commit 8bc4664

Browse files
ci-botAniket-Engg
authored andcommitted
update workspaces based on events and not timeout
1 parent ed794b8 commit 8bc4664

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

apps/remix-ide/src/app/components/top-bar.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@ export class Topbar extends Plugin {
5252
}
5353

5454
async getWorkspaces() {
55-
while (this.workspaces.length === 0) {
56-
await new Promise(resolve => setTimeout(resolve, 100))
57-
this.workspaces = await this.call('filePanel', 'getWorkspaces')
58-
}
55+
this.on('filePanel', 'setWorkspaces', (workspaces) => {
56+
this.workspaces = workspaces
57+
})
5958
return this.workspaces
6059
}
6160

0 commit comments

Comments
 (0)