From d35174d9ccf3df26ea056a0d45043884dcd504c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D0=B0=D1=81=D1=83=D0=BB?= Date: Mon, 11 Nov 2024 14:29:53 +0300 Subject: [PATCH] feat: added command for cockets to pass projectid --- src/components/App/index.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/App/index.tsx b/src/components/App/index.tsx index b5eadffae..54d49022b 100644 --- a/src/components/App/index.tsx +++ b/src/components/App/index.tsx @@ -281,9 +281,7 @@ export const App = () => { const ws = new WebSocket('wss://jobs.stakwork.com/cable?channel=ProjectLogChannel') ws.onopen = () => { - let id = 'a' - - id = runningProjectId + const id = runningProjectId const command = { command: 'subscribe', @@ -321,6 +319,16 @@ export const App = () => { } }, [runningProjectId, setRunningProjectMessages]) + useEffect(() => { + if (runningProjectId) { + try { + socket?.emit('update_project_id', { id: runningProjectId }) + } catch (error) { + console.error(error) + } + } + }, [runningProjectId, socket]) + useEffect(() => { if (!splashDataLoading) { if (chatInterfaceFeatureFlag) {