({ workspaceId, tableId }: RowMutationContext)
| 2115 | } |
| 2116 | |
| 2117 | export 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 | |
| 2140 | interface UpdateWorkflowGroupVariables { |
| 2141 | groupId: string |
no test coverage detected