diff --git a/.gitignore b/.gitignore index 2e3e571..a45496a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ node_modules .pnp .pnp.js /.history - +tsconfig.tsbuildinfo/ # Local env files .env .env.local diff --git a/apps/http-backend/src/routes/userRoutes/userRoutes.ts b/apps/http-backend/src/routes/userRoutes/userRoutes.ts index 5420479..6ec7fe3 100644 --- a/apps/http-backend/src/routes/userRoutes/userRoutes.ts +++ b/apps/http-backend/src/routes/userRoutes/userRoutes.ts @@ -434,9 +434,9 @@ router.get( ); -router.put("/workflow/update" , userMiddleware , (req : AuthRequest , res : Response) => { +// router.put("/workflow/update" , userMiddleware , (req : AuthRequest , res : Response) => { -}) +// }) // ---------------------------------------- INSERTING DATA INTO NODES/ TRIGGER TABLE----------------------------- router.post( diff --git a/apps/web/app/workflows/[id]/components/ConfigModal.tsx b/apps/web/app/workflows/[id]/components/ConfigModal.tsx index 135c582..6a4d741 100644 --- a/apps/web/app/workflows/[id]/components/ConfigModal.tsx +++ b/apps/web/app/workflows/[id]/components/ConfigModal.tsx @@ -4,6 +4,7 @@ import { getNodeConfig } from "@/app/lib/nodeConfigs"; import { useState } from "react"; import { HOOKS_URL } from "@repo/common/zod"; import { userAction } from "@/store/slices/userSlice"; +import { useAppSelector } from "@/app/hooks/redux"; interface ConfigModalProps { isOpen: boolean; selectedNode: any | null; @@ -20,7 +21,7 @@ export default function ConfigModal({ const [loading, setLoading] = useState(false); if (!isOpen || !selectedNode) return null; - const userId =userAction.setUserId as unknown as string; + const userId = useAppSelector((state) => state.user.userId) as unknown as string; console.log("we are getting this userId from ConfigModal" , userId) const handleSave = async () => { setLoading(true); diff --git a/apps/web/app/workflows/[id]/components/nodes/PlaceholderNode.tsx b/apps/web/app/workflows/[id]/components/nodes/PlaceholderNode.tsx index fc174ab..b564710 100644 --- a/apps/web/app/workflows/[id]/components/nodes/PlaceholderNode.tsx +++ b/apps/web/app/workflows/[id]/components/nodes/PlaceholderNode.tsx @@ -1,7 +1,6 @@ -'use client'; - -import { Handle , Position } from "@xyflow/react"; +"use client"; +import { Handle, Position } from "@xyflow/react"; interface PlaceholderNodeProps { data: { @@ -11,12 +10,12 @@ interface PlaceholderNodeProps { export function PlaceholderNode({ data }: PlaceholderNodeProps) { return ( -
- +
diff --git a/apps/web/app/workflows/[id]/page.tsx b/apps/web/app/workflows/[id]/page.tsx index fe9de91..e4c92ca 100644 --- a/apps/web/app/workflows/[id]/page.tsx +++ b/apps/web/app/workflows/[id]/page.tsx @@ -58,33 +58,36 @@ export default function WorkflowCanvas() { const handleNodesChange = (changes: NodeChange[]) => { onNodesChange(changes); // Update UI first - - changes.forEach((change) => { - if (change.type === "position" && change.position) { - // Find the node in local state to check its type - const changedNode = nodes.find((n) => n.id === change.id); - - if (changedNode?.data?.nodeType === "trigger") { - // If it's a trigger node, update via trigger API - api.triggers.update({ - TriggerId: change.id, - Config: { - ...(typeof changedNode.data.config === "object" && - changedNode.data.config !== null - ? changedNode.data.config - : {}), + try { + changes.forEach((change) => { + if (change.type === "position" && change.position) { + // Find the node in local state to check its type + const changedNode = nodes.find((n) => n.id === change.id); + + if (changedNode?.data?.nodeType === "trigger") { + // If it's a trigger node, update via trigger API + api.triggers.update({ + TriggerId: change.id, + Config: { + ...(typeof changedNode.data.config === "object" && + changedNode.data.config !== null + ? changedNode.data.config + : {}), + position: change.position, + }, + }); + } else { + // Otherwise, update in node table + api.nodes.update({ + NodeId: change.id, position: change.position, - }, - }); - } else { - // Otherwise, update in node table - api.nodes.update({ - NodeId: change.id, - position: change.position, - }); + }); + } } - } - }); + }); + } catch (error: any) { + setError(error); + } }; // const handleActionSelection = async (action: any) => { // try { @@ -427,7 +430,7 @@ export default function WorkflowCanvas() { const isTrigger = nodes.find((n) => n.id === nodeId)?.data.nodeType === "trigger"; if (isTrigger) { - await api.triggers.update({ TriggerId: nodeId, Config: config }); + await api.triggers.update({ TriggerId: nodeId, Config: config}); } else { await api.nodes.update({ NodeId: nodeId, Config: config }); }