Skip to content

Commit ad1fb33

Browse files
committed
fix(core,sdk,react-hooks): finish the concurrency-option surface swap
Removes the combined override client methods the previous commit intended to drop, moves react-hooks trigger options off the queue tuple onto the concurrency names, merges a duplicated type import, and marks the new type-only imports as such for the linter.
1 parent d12e958 commit ad1fb33

3 files changed

Lines changed: 11 additions & 20 deletions

File tree

packages/core/src/v3/types/tasks.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { TaskConcurrency } from "./queues.js";
21
import type { SerializableJson } from "../../schemas/json.js";
32
import type { TriggerApiRequestOptions } from "../apiClient/index.js";
43
import type {
@@ -27,7 +26,7 @@ import type {
2726
TaskRunContext,
2827
} from "../schemas/index.js";
2928
import type { IdempotencyKey } from "./idempotencyKeys.js";
30-
import type { QueueOptions } from "./queues.js";
29+
import type { QueueOptions, TaskConcurrency } from "./queues.js";
3130
import type { AnySchemaParseFn, inferSchemaIn, inferSchemaOut, Schema } from "./schemas.js";
3231
import type { inferToolParameters, ToolTaskParameters } from "./tools.js";
3332
import type { Prettify } from "./utils.js";

packages/react-hooks/src/hooks/useTaskTrigger.ts

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,27 +73,19 @@ export function useTaskTrigger<TTask extends AnyTask>(
7373

7474
const payloadPacket = await stringifyIO(payload);
7575

76-
/**
77-
* The queue option is a name or a [name, ...gates] tuple; the request body carries
78-
* the home queue and the gate list separately.
79-
*/
80-
const queueOption = options?.queue;
81-
const queueName = typeof queueOption === "string" ? queueOption : queueOption?.[0];
82-
const gates = Array.isArray(queueOption)
83-
? queueOption
84-
.slice(1)
85-
.map((gate) =>
86-
typeof gate === "string"
87-
? { queue: gate }
88-
: { queue: gate.name, concurrencyKey: gate.concurrencyKey }
89-
)
76+
const queueName = options?.queue;
77+
const concurrency = options?.concurrency
78+
? (Array.isArray(options.concurrency) ? options.concurrency : [options.concurrency]).slice(
79+
0,
80+
2
81+
)
9082
: undefined;
9183

9284
const handle = await apiClient.triggerTask(id, {
9385
payload: payloadPacket.data,
9486
options: {
9587
queue: queueName ? { name: queueName } : undefined,
96-
gates,
88+
concurrency,
9789
concurrencyKey: options?.concurrencyKey,
9890
payloadType: payloadPacket.dataType,
9991
idempotencyKey: await makeIdempotencyKey(options?.idempotencyKey),

packages/trigger-sdk/src/v3/shared.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ import {
9090
type TriggerAndWaitOptions,
9191
type TriggerApiRequestOptions,
9292
type TriggerOptions,
93-
TaskConcurrency,
94-
ConcurrencyLimitOptions,
95-
ConcurrencyLimit,
93+
type TaskConcurrency,
94+
type ConcurrencyLimitOptions,
95+
type ConcurrencyLimit,
9696
} from "@trigger.dev/core/v3";
9797
import { tracer } from "./tracer.js";
9898

0 commit comments

Comments
 (0)