Skip to content

Commit b923c26

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
fix(workflow): guard resource deploy metadata loading
1 parent b8eabc5 commit b923c26

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]

apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-content/resource-content.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,8 @@ export function EmbeddedWorkflowActions({ workspaceId, workflowId }: EmbeddedWor
362362
const { data: session } = useSession()
363363
const hostContext = useWorkspaceHostContext()
364364
const { userPermissions: effectivePermissions } = useWorkspacePermissionsContext()
365-
const { data: workflowMap = {} } = useWorkflowMap(workspaceId)
366-
const { data: folderMap = {} } = useFolderMap(workspaceId)
365+
const { data: workflowMap, isLoading: isWorkflowMapLoading } = useWorkflowMap(workspaceId)
366+
const { data: folderMap, isLoading: isFolderMapLoading } = useFolderMap(workspaceId)
367367
const setActiveWorkflow = useWorkflowRegistry((state) => state.setActiveWorkflow)
368368
const { handleRunWorkflow, handleCancelExecution } = useWorkflowExecution()
369369
const isExecuting = useExecutionStore(
@@ -383,7 +383,11 @@ export function EmbeddedWorkflowActions({ workspaceId, workflowId }: EmbeddedWor
383383
const isRunButtonDisabled =
384384
!isExecuting &&
385385
(isUsageGateLoading || (!effectivePermissions.canRead && !effectivePermissions.isLoading))
386-
const isWorkflowLocked = isWorkflowEffectivelyLocked(workflowMap[workflowId], folderMap)
386+
const isWorkflowLockDataLoading =
387+
isWorkflowMapLoading || isFolderMapLoading || !workflowMap || !folderMap
388+
const isWorkflowLocked =
389+
isWorkflowLockDataLoading ||
390+
isWorkflowEffectivelyLocked(workflowMap?.[workflowId], folderMap ?? {})
387391

388392
const handleRun = async () => {
389393
setActiveWorkflow(workflowId)

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/deploy.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ vi.mock('@/stores/workflows/registry/store', () => ({
8383
selector({ hydration: { phase: mockState.hydrationPhase } }),
8484
}))
8585

86-
import { Deploy } from './deploy'
86+
import { Deploy } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/deploy'
8787

8888
let container: HTMLDivElement
8989
let root: Root

0 commit comments

Comments
 (0)