From 5ec9d0f1347eda1aecea72ab00348a56eb3d0ec6 Mon Sep 17 00:00:00 2001 From: Jason Rudolph Date: Sun, 15 Oct 2017 09:59:41 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20bug=20disposing=20watchers?= =?UTF-8?q?=20in=20Project::addPath?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `this.rootDirectories` is an Array of Directory objects. `path` is a String. Therefore, `this.rootDirectories.includes(path)` will always evaluate to `false`. We instead need to look for an entry in `this.rootDirectories` where the Directory object's path is equal to the given path. --- src/project.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/project.js b/src/project.js index 4f95cf851..b99a60e85 100644 --- a/src/project.js +++ b/src/project.js @@ -347,7 +347,7 @@ class Project extends Model { }) for (let path in this.watcherPromisesByPath) { - if (!this.rootDirectories.includes(path)) { + if (!this.rootDirectories.find(dir => dir.getPath() === path)) { this.watcherPromisesByPath[path].then(watcher => { watcher.dispose() }) } }