Skip to content

Commit fb9face

Browse files
committed
fix: profiles in tray menu may show duplicates
We had a race condition in the chokidar file update handler.
1 parent 197e63d commit fb9face

File tree

1 file changed

+3
-2
lines changed
  • plugins/plugin-codeflare/src/tray/watchers/profile

1 file changed

+3
-2
lines changed

Diff for: plugins/plugin-codeflare/src/tray/watchers/profile/list.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,12 @@ export default class ProfileWatcher {
6262
return
6363
}
6464

65+
const profileObj = await Profiles.restore(this.madwizardOptions, basename(path)).then((_) => _.profile)
6566
const idx = this.profiles.findIndex((_) => _.name === profile)
6667
if (idx < 0) {
67-
this._profiles.push(await Profiles.restore(this.madwizardOptions, basename(path)).then((_) => _.profile))
68+
this._profiles.push(profileObj)
6869
} else {
69-
this._profiles[idx] = await Profiles.restore(this.madwizardOptions, basename(path)).then((_) => _.profile)
70+
this._profiles[idx] = profileObj
7071
}
7172
this.updateFn()
7273
} catch (err) {

0 commit comments

Comments
 (0)