Skip to content

Commit b58f591

Browse files
committed
Updates
Please enter the commit message for your changes. Lines starting
1 parent 5f42543 commit b58f591

11 files changed

Lines changed: 701 additions & 263 deletions

File tree

apps/sim/app/api/workflows/utils.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,19 @@ export function createSuccessResponse(data: any) {
3131
* This is the single source of truth for redeployment detection — used by
3232
* both the /deploy and /status endpoints to ensure consistent results.
3333
*/
34+
/**
35+
* Pure redeployment-change comparison shared by checkNeedsRedeployment and the
36+
* VFS deployment serializer so both surfaces agree. Returns false when either
37+
* side is missing.
38+
*/
39+
export function computeNeedsRedeployment(
40+
currentSnapshot: WorkflowState | null | undefined,
41+
activeState: WorkflowState | null | undefined
42+
): boolean {
43+
if (!activeState || !currentSnapshot) return false
44+
return hasWorkflowChanged(currentSnapshot, activeState)
45+
}
46+
3447
export async function checkNeedsRedeployment(workflowId: string): Promise<boolean> {
3548
const [active] = await db
3649
.select({ state: workflowDeploymentVersion.state })
@@ -44,12 +57,8 @@ export async function checkNeedsRedeployment(workflowId: string): Promise<boolea
4457
.orderBy(desc(workflowDeploymentVersion.createdAt))
4558
.limit(1)
4659

47-
if (!active?.state) return false
48-
4960
const currentState = await loadWorkflowDeploymentSnapshot(workflowId)
50-
if (!currentState) return false
51-
52-
return hasWorkflowChanged(currentState, active.state as WorkflowState)
61+
return computeNeedsRedeployment(currentState, (active?.state as WorkflowState) ?? null)
5362
}
5463

5564
/**

0 commit comments

Comments
 (0)