diff --git a/sim/app/w/[id]/workflow.tsx b/sim/app/w/[id]/workflow.tsx index c099087dfd..c1fb2c1035 100644 --- a/sim/app/w/[id]/workflow.tsx +++ b/sim/app/w/[id]/workflow.tsx @@ -43,9 +43,6 @@ function WorkflowContent() { // State const [selectedEdgeId, setSelectedEdgeId] = useState(null) const [isInitialized, setIsInitialized] = useState(false) - const [isPublicWorkflow, setIsPublicWorkflow] = useState(false) - const [publicWorkflowData, setPublicWorkflowData] = useState(null) - const [loadingPublicWorkflow, setLoadingPublicWorkflow] = useState(false) // Hooks const params = useParams() @@ -54,16 +51,8 @@ function WorkflowContent() { // Store access const { workflows, setActiveWorkflow, createWorkflow } = useWorkflowRegistry() - const { - blocks, - edges, - loops, - addBlock, - updateBlockPosition, - addEdge, - removeEdge, - initializeWorkflow, - } = useWorkflowStore() + const { blocks, edges, loops, addBlock, updateBlockPosition, addEdge, removeEdge } = + useWorkflowStore() const { setValue: setSubBlockValue } = useSubBlockStore() const { markAllAsRead } = useNotificationStore() const { resetLoaded: resetVariablesLoaded } = useVariablesStore() @@ -162,47 +151,9 @@ function WorkflowContent() { return } - // Check if the workflow is in the user's registry if (!workflows[currentId]) { - // If not in registry, try to load it as a public workflow - setLoadingPublicWorkflow(true) - try { - const response = await fetch(`/api/workflows/public/${currentId}`) - - if (response.ok) { - // Workflow exists and is public - const data = await response.json() - setPublicWorkflowData(data.data) - setIsPublicWorkflow(true) - - // Initialize the workflow store with the public workflow state - if (data.data?.state) { - const { blocks, edges, loops } = data.data.state - initializeWorkflow(blocks || {}, edges || [], loops || {}) - - // Initialize subblock store with workflow values - if (blocks) { - useSubBlockStore.getState().initializeFromWorkflow(currentId, blocks) - } - } - setLoadingPublicWorkflow(false) - return - } else if (response.status === 403) { - // Workflow exists but is not public, redirect to first workflow - router.replace(`/w/${workflowIds[0]}`) - return - } else { - // Workflow doesn't exist, redirect to first workflow - router.replace(`/w/${workflowIds[0]}`) - return - } - } catch (error) { - console.error('Error loading public workflow:', error) - router.replace(`/w/${workflowIds[0]}`) - return - } finally { - setLoadingPublicWorkflow(false) - } + router.replace(`/w/${workflowIds[0]}`) + return } // Import the isActivelyLoadingFromDB function to check sync status @@ -239,7 +190,6 @@ function WorkflowContent() { isInitialized, markAllAsRead, resetVariablesLoaded, - initializeWorkflow, ]) // Transform blocks and loops into ReactFlow nodes diff --git a/sim/app/w/marketplace/components/workflow-card.tsx b/sim/app/w/marketplace/components/workflow-card.tsx index 264493437e..562438290f 100644 --- a/sim/app/w/marketplace/components/workflow-card.tsx +++ b/sim/app/w/marketplace/components/workflow-card.tsx @@ -1,7 +1,6 @@ 'use client' import { useEffect, useState } from 'react' -import Link from 'next/link' import { Eye, Star } from 'lucide-react' import { Card, CardContent, CardFooter, CardHeader } from '@/components/ui/card' import { Workflow } from '../marketplace' @@ -61,18 +60,10 @@ export function WorkflowCard({ workflow, onHover }: WorkflowCardProps) { } } - // Extract the actual workflow ID from workflow - const workflowUrl = workflow.workflowUrl || `/w/${workflow.id}` - return ( - +
{/* Workflow preview/thumbnail area */} @@ -126,6 +117,6 @@ export function WorkflowCard({ workflow, onHover }: WorkflowCardProps) {
- + ) } diff --git a/sim/stores/workflows/workflow/store.ts b/sim/stores/workflows/workflow/store.ts index fe0457cae3..487f27c5df 100644 --- a/sim/stores/workflows/workflow/store.ts +++ b/sim/stores/workflows/workflow/store.ts @@ -306,23 +306,6 @@ export const useWorkflowStore = create()( } }, - // Initialize workflow from external state (used for public workflows) - initializeWorkflow: (blocks: any, edges: any, loops: any) => { - const newState = { - blocks: blocks || {}, - edges: edges || [], - loops: loops || {}, - lastSaved: Date.now(), - isDeployed: false, - deployedAt: undefined, - isPublished: true, - } - - set(newState) - // Don't push to history since this is an initial load - // Don't sync to avoid overwriting the original workflow - }, - toggleBlockEnabled: (id: string) => { const newState = { blocks: { diff --git a/sim/stores/workflows/workflow/types.ts b/sim/stores/workflows/workflow/types.ts index 8d5b3793d2..88adc44905 100644 --- a/sim/stores/workflows/workflow/types.ts +++ b/sim/stores/workflows/workflow/types.ts @@ -62,7 +62,6 @@ export interface WorkflowActions { triggerUpdate: () => void setDeploymentStatus: (isDeployed: boolean, deployedAt?: Date) => void setPublishStatus: (isPublished: boolean) => void - initializeWorkflow: (blocks: any, edges: any, loops: any) => void } export type WorkflowStore = WorkflowState & WorkflowActions