From ccc14f3c97b6777b66c8e7d8a38444ff56756ddc Mon Sep 17 00:00:00 2001 From: Ishaan Dey Date: Thu, 9 May 2024 00:45:10 -0700 Subject: [PATCH] fix folder id bug --- backend/server/src/index.ts | 2 +- backend/server/src/utils.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/server/src/index.ts b/backend/server/src/index.ts index d03ad98..bd88709 100644 --- a/backend/server/src/index.ts +++ b/backend/server/src/index.ts @@ -243,7 +243,7 @@ io.on("connection", async (socket) => { }) const onData = pty.onData((data) => { - console.log("terminalResponse", id, data) + // console.log("terminalResponse", id, data) io.emit("terminalResponse", { id, data, diff --git a/backend/server/src/utils.ts b/backend/server/src/utils.ts index eb660c6..1595285 100644 --- a/backend/server/src/utils.ts +++ b/backend/server/src/utils.ts @@ -48,7 +48,8 @@ const processFiles = async (paths: string[], id: string) => { fileData.push({ id: path, data: "" }) } else { const folder: TFolder = { - id: path, // todo: wrong id. for example, folder "src" ID is: projects/a7vgttfqbgy403ratp7du3ln/src/App.css + // id: path, // todo: wrong id. for example, folder "src" ID is: projects/a7vgttfqbgy403ratp7du3ln/src/App.css + id: `projects/${id}/${parts.slice(0, i + 1).join("/")}`, type: "folder", name: part, children: [], @@ -67,6 +68,8 @@ const processFiles = async (paths: string[], id: string) => { }) ) + console.log("root", root) + return { files: root.children, fileData,