Skip to content

Commit 44df76d

Browse files
committed
fix(deploy): forward AbortSignal in fetchDeployedWorkflowState
Match the pattern used by all other fetch helpers in the file so in-flight requests are cancelled on component unmount or query re-trigger.
1 parent 3ea2628 commit 44df76d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

apps/sim/hooks/queries/deployments.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,11 @@ export function useDeploymentInfo(workflowId: string | null, options?: { enabled
9595
/**
9696
* Fetches the deployed workflow state snapshot for a workflow
9797
*/
98-
async function fetchDeployedWorkflowState(workflowId: string): Promise<WorkflowState | null> {
99-
const response = await fetch(`/api/workflows/${workflowId}/deployed`)
98+
async function fetchDeployedWorkflowState(
99+
workflowId: string,
100+
signal?: AbortSignal
101+
): Promise<WorkflowState | null> {
102+
const response = await fetch(`/api/workflows/${workflowId}/deployed`, { signal })
100103

101104
if (!response.ok) {
102105
if (response.status === 404) return null
@@ -117,7 +120,7 @@ export function useDeployedWorkflowState(
117120
) {
118121
return useQuery({
119122
queryKey: deploymentKeys.deployedState(workflowId),
120-
queryFn: () => fetchDeployedWorkflowState(workflowId!),
123+
queryFn: ({ signal }) => fetchDeployedWorkflowState(workflowId!, signal),
121124
enabled: Boolean(workflowId) && (options?.enabled ?? true),
122125
staleTime: 30 * 1000,
123126
})

0 commit comments

Comments
 (0)