Skip to content

Commit dfca04a

Browse files
authored
Docs: Updates the run function params syntax + adds new run.list() example (#1976)
1 parent 672a6b8 commit dfca04a

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

docs/upgrade-to-v4.mdx

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ pnpm dlx trigger.dev@v4-beta dev
508508

509509
During the beta we will be tracking issues and releasing regular fixes.
510510

511-
There are no known issues at the moment.
511+
**ISSUE:** Runs not continuing after a child run(s) have completed.
512512

513513
## Deprecations
514514

@@ -703,7 +703,8 @@ import { task } from "@trigger.dev/sdk";
703703
export const myTask = task({
704704
id: "my-task",
705705
onStart: ({ payload, ctx }) => {},
706-
run: async ({ payload, ctx }) => {},
706+
// The run function still uses separate parameters
707+
run: async ( payload, { ctx }) => {},
707708
});
708709
```
709710

@@ -721,7 +722,7 @@ export const myTask = task({
721722
onResume: ({ payload, ctx, task, wait }) => {},
722723
onComplete: ({ payload, ctx, task, result }) => {},
723724
catchError: ({ payload, ctx, task, error, retry, retryAt, retryDelayInMs }) => {},
724-
run: async ({ payload, ctx }) => {},
725+
run: async (payload, { ctx }) => {},
725726
});
726727
```
727728

@@ -731,3 +732,32 @@ We've made a few small changes to the `ctx` object:
731732

732733
- `ctx.attempt.id` and `ctx.attempt.status` have been removed. `ctx.attempt.number` is still available.
733734
- `ctx.task.exportName` has been removed (since we no longer require tasks to be exported to be triggered).
735+
736+
### BatchTrigger changes
737+
738+
The `batchTrigger` function no longer returns a `runs` list directly. In v3, you could access the runs directly from the batch handle:
739+
740+
```ts
741+
// In v3
742+
const batchHandle = await tasks.batchTrigger([
743+
[myTask, { foo: "bar" }],
744+
[myOtherTask, { baz: "qux" }],
745+
]);
746+
747+
// You could access runs directly
748+
console.log(batchHandle.runs);
749+
```
750+
751+
In v4, you now need to use the `runs.list()` method to get the list of runs:
752+
753+
```ts
754+
// In v4
755+
const batchHandle = await tasks.batchTrigger([
756+
[myTask, { foo: "bar" }],
757+
[myOtherTask, { baz: "qux" }],
758+
]);
759+
760+
// Now you need to call runs.list()
761+
const runs = await batchHandle.runs.list();
762+
console.log(runs);
763+
```

0 commit comments

Comments
 (0)