diff --git a/packages/toolkit/src/lib/use-instill-form/components/trigger-request-form-fields/FileAndStringUploadField.tsx b/packages/toolkit/src/lib/use-instill-form/components/trigger-request-form-fields/FileAndStringUploadField.tsx index a3d083e10c..ab6a9a88af 100644 --- a/packages/toolkit/src/lib/use-instill-form/components/trigger-request-form-fields/FileAndStringUploadField.tsx +++ b/packages/toolkit/src/lib/use-instill-form/components/trigger-request-form-fields/FileAndStringUploadField.tsx @@ -82,7 +82,7 @@ export const FileAndStringUploadField = ({ field.onChange(e.target.value); setFileName(e.target.value); }} - placeholder="Enter a URL, paste a file, or drag a file over." + placeholder="Enter a URL, upload a file, or drag a file over." className="w-full p-2 border rounded" disabled={disabled} /> diff --git a/packages/toolkit/src/view/recipe-editor/flow/nodes/StartNode.tsx b/packages/toolkit/src/view/recipe-editor/flow/nodes/StartNode.tsx index d9f51b1fdc..022a9835b2 100644 --- a/packages/toolkit/src/view/recipe-editor/flow/nodes/StartNode.tsx +++ b/packages/toolkit/src/view/recipe-editor/flow/nodes/StartNode.tsx @@ -17,8 +17,7 @@ import { CustomHandle } from "./CustomHandle"; const selector = (store: InstillStore) => ({ enabledQuery: store.enabledQuery, accessToken: store.accessToken, - displayEventNodes: store.displayEventNodes, - updateDisplayEventNodes: store.updateDisplayEventNodes, + updateSelectedComponentId: store.updateSelectedComponentId, }); export const StartNode = ({ id }: NodeProps) => { @@ -31,7 +30,8 @@ export const StartNode = ({ id }: NodeProps) => { ); }, [id, reactflowEdges]); - const { enabledQuery, accessToken } = useInstillStore(useShallow(selector)); + const { enabledQuery, accessToken, updateSelectedComponentId } = + useInstillStore(useShallow(selector)); const pipeline = useNamespacePipeline({ namespaceId: routeInfo.data.namespaceId, @@ -59,7 +59,12 @@ export const StartNode = ({ id }: NodeProps) => { }, [pipeline.data, pipeline.isSuccess]); return ( -
+
{ + updateSelectedComponentId(() => null); + }} + className="relative" + > {eventCount > 0 ? ( { ); }; +const buttonSelector = (store: InstillStore) => ({ + displayEventNodes: store.displayEventNodes, + updateDisplayEventNodes: store.updateDisplayEventNodes, +}); + const StartNodeOpenEventButton = ({ eventCount, hasEventErrorEdge, @@ -93,7 +103,7 @@ const StartNodeOpenEventButton = ({ hasEventErrorEdge: boolean; }) => { const { displayEventNodes, updateDisplayEventNodes } = useInstillStore( - useShallow(selector), + useShallow(buttonSelector), ); if (hasEventErrorEdge) { diff --git a/packages/toolkit/src/view/recipe-editor/lib/PipelineFlowFactory/PipelineFlowFactory.ts b/packages/toolkit/src/view/recipe-editor/lib/PipelineFlowFactory/PipelineFlowFactory.ts index b8998806bf..6db901a75c 100644 --- a/packages/toolkit/src/view/recipe-editor/lib/PipelineFlowFactory/PipelineFlowFactory.ts +++ b/packages/toolkit/src/view/recipe-editor/lib/PipelineFlowFactory/PipelineFlowFactory.ts @@ -124,7 +124,7 @@ export class PipelineFlowFactory { if (!hasVariableConnectToRunOnEvent) { edges.push({ id: `run-on-event-${id}`, - source: `on-${id}`, + source: id, target: "start", type: "eventErrorEdge", hidden: hideEventNodes, @@ -134,7 +134,7 @@ export class PipelineFlowFactory { edges.push({ id: `run-on-event-${id}`, - source: `on-${id}`, + source: id, target: "start", type: "eventEdge", hidden: hideEventNodes, diff --git a/packages/toolkit/src/view/recipe-editor/lib/PipelineFlowFactory/edgeHelpers/composeEdgesForReference.ts b/packages/toolkit/src/view/recipe-editor/lib/PipelineFlowFactory/edgeHelpers/composeEdgesForReference.ts index 6d35337419..e2b76416d2 100644 --- a/packages/toolkit/src/view/recipe-editor/lib/PipelineFlowFactory/edgeHelpers/composeEdgesForReference.ts +++ b/packages/toolkit/src/view/recipe-editor/lib/PipelineFlowFactory/edgeHelpers/composeEdgesForReference.ts @@ -39,14 +39,18 @@ export function composeEdgesForReference({ const hasNoEdgeForThisReference = currentEdges.find( - (edge) => - edge.source === `on-${sourceId}` && edge.target === reference.id, + (edge) => edge.source === sourceId && edge.target === reference.id, ) === undefined; - if (referenceIsAvailable && hasNoEdgeForThisReference && reference.id) { + if ( + sourceId && + referenceIsAvailable && + hasNoEdgeForThisReference && + reference.id + ) { newEdges.push({ id: uuidv4(), - source: `on-${sourceId}`, + source: sourceId, target: reference.id, type: "generalEdge", }); diff --git a/packages/toolkit/src/view/recipe-editor/lib/PipelineFlowFactory/nodeHelpers/createNodesFromRunOnEvent.ts b/packages/toolkit/src/view/recipe-editor/lib/PipelineFlowFactory/nodeHelpers/createNodesFromRunOnEvent.ts index 87618d04df..4ab0453df6 100644 --- a/packages/toolkit/src/view/recipe-editor/lib/PipelineFlowFactory/nodeHelpers/createNodesFromRunOnEvent.ts +++ b/packages/toolkit/src/view/recipe-editor/lib/PipelineFlowFactory/nodeHelpers/createNodesFromRunOnEvent.ts @@ -22,7 +22,7 @@ export function createNodesFromRunOnEvent( } nodes.push({ - id: `on-${id}`, + id: id, type: "runOnEventNode", hidden: hideEventNodes, data: e,