From 66df55fd21939b72279bfef64c9094a4f345b72e Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Wed, 11 Jan 2023 12:12:14 -0500 Subject: [PATCH] fix(core): fix dependent projects for watch (#14170) --- .../file-watching/file-watcher-sockets.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/nx/src/daemon/server/file-watching/file-watcher-sockets.ts b/packages/nx/src/daemon/server/file-watching/file-watcher-sockets.ts index 6a794c1ce2c60..85d38ef560b5a 100644 --- a/packages/nx/src/daemon/server/file-watching/file-watcher-sockets.ts +++ b/packages/nx/src/daemon/server/file-watching/file-watcher-sockets.ts @@ -55,20 +55,20 @@ export function notifyFileWatcherSockets( changedFiles.push(...projectFiles); } } else { - const watchedProjects = [...config.watchProjects]; + const watchedProjects = new Set(config.watchProjects); if (config.includeDependentProjects) { - for (const project of watchedProjects) { - watchedProjects.push( - ...findAllProjectNodeDependencies( - project, - currentProjectGraphCache as ProjectGraph - ) - ); + for (const project of config.watchProjects) { + for (const dep of findAllProjectNodeDependencies( + project, + currentProjectGraphCache as ProjectGraph + )) { + watchedProjects.add(dep); + } } } - for (const watchedProject of new Set(watchedProjects)) { + for (const watchedProject of watchedProjects) { if (!!projectAndGlobalChanges.projects[watchedProject]) { changedProjects.push(watchedProject);