diff --git a/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx b/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx index f098b9e9..a927a5d6 100644 --- a/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx +++ b/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx @@ -245,18 +245,11 @@ function Workspace({ const [openCycleBrowserDialogue, setOpenCycleBrowserDialogue] = useState(false); - const [toDeleteCacheKeyValue, setToDeleteCacheKeyValue] = useState< - string | null - >(null); const [isCopilotOpen, setIsCopilotOpen] = useState( () => !initialNodes.some(isWorkflowBlockNode), ); const [copilotMessageCount, setCopilotMessageCount] = useState(0); const copilotButtonRef = useRef(null); - const [ - openConfirmCacheKeyValueDeleteDialogue, - setOpenConfirmCacheKeyValueDeleteDialogue, - ] = useState(false); const [activeDebugSession, setActiveDebugSession] = useState(null); const [showPowerButton, setShowPowerButton] = useState(true); @@ -634,8 +627,6 @@ function Workspace({ queryClient.invalidateQueries({ queryKey: ["cache-key-values", workflowPermanentId, cacheKey], }); - setToDeleteCacheKeyValue(null); - setOpenConfirmCacheKeyValueDeleteDialogue(false); }, onError: (error: AxiosError) => { toast({ @@ -643,8 +634,6 @@ function Workspace({ title: "Failed to delete code key value", description: error.message, }); - setToDeleteCacheKeyValue(null); - setOpenConfirmCacheKeyValueDeleteDialogue(false); }, }); @@ -1147,65 +1136,6 @@ function Workspace({ - {/* cache key value delete dialog */} - { - if (!open && deleteCacheKeyValue.isPending) { - return; - } - setOpenConfirmCacheKeyValueDeleteDialogue(open); - }} - > - - - Delete Generated Code - -
- {deleteCacheKeyValue.isPending ? ( - "Deleting generated code..." - ) : ( -
-
- Are you sure you want to delete the generated code for - this code key value? -
-
- {toDeleteCacheKeyValue} -
-
- )} -
-
-
- - {!deleteCacheKeyValue.isPending && ( - - - - )} - - -
-
- {/* header panel */}
{ - setToDeleteCacheKeyValue(cacheKeyValue); - setOpenConfirmCacheKeyValueDeleteDialogue(true); + deleteCacheKeyValue.mutate({ + workflowPermanentId: workflowPermanentId!, + cacheKeyValue, + }); }} onPaginate={(page) => { setPage(page); @@ -1386,8 +1318,10 @@ function Workspace({ pending={cacheKeyValuesLoading} scriptKey={workflow.cache_key ?? "default"} onDelete={(cacheKeyValue) => { - setToDeleteCacheKeyValue(cacheKeyValue); - setOpenConfirmCacheKeyValueDeleteDialogue(true); + deleteCacheKeyValue.mutate({ + workflowPermanentId: workflowPermanentId!, + cacheKeyValue, + }); }} onPaginate={(page) => { setPage(page); @@ -1440,8 +1374,10 @@ function Workspace({ pending={cacheKeyValuesLoading} scriptKey={workflow.cache_key ?? "default"} onDelete={(cacheKeyValue) => { - setToDeleteCacheKeyValue(cacheKeyValue); - setOpenConfirmCacheKeyValueDeleteDialogue(true); + deleteCacheKeyValue.mutate({ + workflowPermanentId: workflowPermanentId!, + cacheKeyValue, + }); }} onPaginate={(page) => { setPage(page);