MCPcopy Index your code
hub / github.com/simstudioai/sim / useAddWorkflowGroup

Function useAddWorkflowGroup

apps/sim/hooks/queries/tables.ts:2117–2138  ·  view source on GitHub ↗
({ workspaceId, tableId }: RowMutationContext)

Source from the content-addressed store, hash-verified

2115}
2116
2117export function useAddWorkflowGroup({ workspaceId, tableId }: RowMutationContext) {
2118 const queryClient = useQueryClient()
2119 return useMutation({
2120 mutationFn: async ({ group, outputColumns }: AddWorkflowGroupVariables) => {
2121 // Mirror the one-shot "schedule existing rows on creation" flag to the
2122 // group's persisted autoRun. Without this it defaults to `true`, so an
2123 // autoRun=false group opens a dispatch the scheduler then skips per-cell
2124 // ('autoRun-off') — a no-op run that flashes the "X running" badge.
2125 return requestJson(addWorkflowGroupContract, {
2126 params: { tableId },
2127 body: { workspaceId, group, outputColumns, autoRun: group.autoRun },
2128 })
2129 },
2130 onError: (error) => {
2131 if (isValidationError(error)) return
2132 toast.error(error.message, { duration: 5000 })
2133 },
2134 onSettled: () => {
2135 invalidateTableSchema(queryClient, tableId)
2136 },
2137 })
2138}
2139
2140interface UpdateWorkflowGroupVariables {
2141 groupId: string

Callers 2

EnrichmentConfigFunction · 0.90
WorkflowSidebarBodyFunction · 0.90

Calls 4

requestJsonFunction · 0.90
isValidationErrorFunction · 0.90
invalidateTableSchemaFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected