Skip to content

Commit bd38062

Browse files
authored
fix(workflow-error): allow users to delete workflows with invalid configs/state (#1000)
* fix(workflow-error): allow users to delete workflows with invalid configs/state * cleanup
1 parent d7fd4a9 commit bd38062

File tree

2 files changed

+29
-12
lines changed

2 files changed

+29
-12
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/control-bar/control-bar.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,11 @@ export function ControlBar({ hasValidationErrors = false }: ControlBarProps) {
341341
* Handle deleting the current workflow
342342
*/
343343
const handleDeleteWorkflow = () => {
344-
if (!activeWorkflowId || !userPermissions.canEdit) return
344+
const currentWorkflowId = params.workflowId as string
345+
if (!currentWorkflowId || !userPermissions.canEdit) return
345346

346347
const sidebarWorkflows = getSidebarOrderedWorkflows()
347-
const currentIndex = sidebarWorkflows.findIndex((w) => w.id === activeWorkflowId)
348+
const currentIndex = sidebarWorkflows.findIndex((w) => w.id === currentWorkflowId)
348349

349350
// Find next workflow: try next, then previous
350351
let nextWorkflowId: string | null = null
@@ -363,8 +364,8 @@ export function ControlBar({ hasValidationErrors = false }: ControlBarProps) {
363364
router.push(`/workspace/${workspaceId}`)
364365
}
365366

366-
// Remove the workflow from the registry
367-
useWorkflowRegistry.getState().removeWorkflow(activeWorkflowId)
367+
// Remove the workflow from the registry using the URL parameter
368+
useWorkflowRegistry.getState().removeWorkflow(currentWorkflowId)
368369
}
369370

370371
// Helper function to open subscription settings

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/error/index.tsx

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { Component, type ReactNode, useEffect } from 'react'
44
import { BotIcon } from 'lucide-react'
55
import { Card } from '@/components/ui/card'
66
import { createLogger } from '@/lib/logs/console/logger'
7+
import { ControlBar } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/control-bar/control-bar'
8+
import { Panel } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel'
79

810
const logger = createLogger('ErrorBoundary')
911

@@ -22,18 +24,32 @@ export function ErrorUI({
2224
fullScreen = false,
2325
}: ErrorUIProps) {
2426
const containerClass = fullScreen
25-
? 'flex items-center justify-center w-full h-screen bg-muted/40'
26-
: 'flex items-center justify-center w-full h-full bg-muted/40'
27+
? 'flex flex-col w-full h-screen bg-muted/40'
28+
: 'flex flex-col w-full h-full bg-muted/40'
2729

2830
return (
2931
<div className={containerClass}>
30-
<Card className='max-w-md space-y-4 p-6 text-center'>
31-
<div className='flex justify-center'>
32-
<BotIcon className='h-16 w-16 text-muted-foreground' />
32+
{/* Control bar */}
33+
<ControlBar hasValidationErrors={false} />
34+
35+
{/* Main content area */}
36+
<div className='relative flex flex-1'>
37+
{/* Error message */}
38+
<div className='flex flex-1 items-center justify-center'>
39+
<Card className='max-w-md space-y-4 p-6 text-center'>
40+
<div className='flex justify-center'>
41+
<BotIcon className='h-16 w-16 text-muted-foreground' />
42+
</div>
43+
<h3 className='font-semibold text-lg'>{title}</h3>
44+
<p className='text-muted-foreground'>{message}</p>
45+
</Card>
3346
</div>
34-
<h3 className='font-semibold text-lg'>{title}</h3>
35-
<p className='text-muted-foreground'>{message}</p>
36-
</Card>
47+
48+
{/* Console panel */}
49+
<div className='fixed top-0 right-0 z-10'>
50+
<Panel />
51+
</div>
52+
</div>
3753
</div>
3854
)
3955
}

0 commit comments

Comments
 (0)