From 8b1907afc46457c17fa870ec5f8d5f43652cc3dc Mon Sep 17 00:00:00 2001 From: Victor Savkin Date: Sat, 20 May 2023 10:32:57 -0400 Subject: [PATCH] fix(core): clone project graph during incremental update --- .../server/project-graph-incremental-recomputation.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/nx/src/daemon/server/project-graph-incremental-recomputation.ts b/packages/nx/src/daemon/server/project-graph-incremental-recomputation.ts index 54efecb987a62..2025ef3029329 100644 --- a/packages/nx/src/daemon/server/project-graph-incremental-recomputation.ts +++ b/packages/nx/src/daemon/server/project-graph-incremental-recomputation.ts @@ -228,6 +228,10 @@ function copyFileMap(m: ProjectFileMap) { return c; } +function copyProjectGraph(p: ProjectGraph): ProjectGraph { + return { ...p }; +} + async function createAndSerializeProjectGraph(): Promise<{ error: string | null; projectGraph: ProjectGraph | null; @@ -251,7 +255,9 @@ async function createAndSerializeProjectGraph(): Promise<{ allWorkspaceFiles, { fileMap: currentProjectFileMapCache || readProjectFileMapCache(), - projectGraph: currentProjectGraph || readProjectGraphCache(), + projectGraph: copyProjectGraph( + currentProjectGraph || readProjectGraphCache() + ), }, true );