diff --git a/skyvern-frontend/src/routes/workflows/components/BlockCodeEditor.tsx b/skyvern-frontend/src/routes/workflows/components/BlockCodeEditor.tsx index ef3034f4..03f664da 100644 --- a/skyvern-frontend/src/routes/workflows/components/BlockCodeEditor.tsx +++ b/skyvern-frontend/src/routes/workflows/components/BlockCodeEditor.tsx @@ -1,14 +1,18 @@ import { ExitIcon } from "@radix-ui/react-icons"; +import { useParams } from "react-router-dom"; import { Handle } from "@xyflow/react"; import { Position } from "@xyflow/react"; +import { KeyIcon } from "@/components/icons/KeyIcon"; import { WorkflowBlockType } from "@/routes/workflows/types/workflowTypes"; import { useToggleScriptForNodeCallback } from "@/routes/workflows/hooks/useToggleScriptForNodeCallback"; +import { useWorkflowQuery } from "@/routes/workflows/hooks/useWorkflowQuery"; import { cn } from "@/util/utils"; import { CodeEditor } from "./CodeEditor"; import { workflowBlockTitle } from "../editor/nodes/types"; import { WorkflowBlockIcon } from "../editor/nodes/WorkflowBlockIcon"; +import { constructCacheKeyValue } from "../editor/utils"; function BlockCodeEditor({ blockLabel, @@ -21,9 +25,20 @@ function BlockCodeEditor({ script: string | undefined; onClick?: (e: React.MouseEvent) => void; }) { + const { workflowPermanentId } = useParams(); const blockTitle = workflowBlockTitle[blockType]; const toggleScriptForNodeCallback = useToggleScriptForNodeCallback(); + const { data: workflow } = useWorkflowQuery({ + workflowPermanentId, + }); + const cacheKey = workflow?.cache_key ?? ""; + const cacheKeyValue = workflow + ? cacheKey === "" + ? "" + : constructCacheKeyValue(cacheKey, workflow) + : ""; + return (