Skip to content

Commit 257d979

Browse files
committed
fix: tray runs watch still adds garbage, and does not respond to deletion
two separate small bugs. on the former, it turns out that chokidar's `depth` option starts at 1, and we were passing 0. on the latter, we had a copy-paste bug, and were pushing on both the addDir and unlink events.
1 parent 622d12a commit 257d979

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default class ProfileWatcher {
3131
public constructor(
3232
private readonly updateFn: UpdateFunction,
3333
private readonly profilesPath: string,
34-
private readonly watcher = chokidar.watch(profilesPath, { depth: 0 })
34+
private readonly watcher = chokidar.watch(profilesPath, { depth: 1 })
3535
) {}
3636

3737
/** Initialize `this._profiles` model */

plugins/plugin-codeflare/src/tray/watchers/profile/run.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default class ProfileRunWatcher {
3939
public constructor(
4040
private readonly updateFn: UpdateFunction,
4141
private readonly profile: string,
42-
private readonly watcher = chokidar.watch(ProfileRunWatcher.path(profile) + "/*", { depth: 0 })
42+
private readonly watcher = chokidar.watch(ProfileRunWatcher.path(profile) + "/*", { depth: 1 })
4343
) {}
4444

4545
private static path(profile: string) {
@@ -71,7 +71,7 @@ export default class ProfileRunWatcher {
7171
const runId = basename(path)
7272
const idx = this.runs.findIndex((_) => _ === runId)
7373
if (idx >= 0) {
74-
this._runs.push(runId)
74+
this._runs.splice(idx, 1)
7575
this.updateFn()
7676
}
7777
})

0 commit comments

Comments
 (0)