Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/triggering.mdx

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Pre-existing doc code errors in childTask1 and childTask2 examples

The example code for childTask1 and childTask2 (shared across the batch.triggerAndWait and batch.triggerByTask sections) contains bugs that would produce incorrect runtime behavior if a user copied them:

  1. At docs/triggering.mdx:565, childTask1 does return \Hello ${payload}`wherepayloadis{ foo: string }. This would stringify to Hello [object Object]instead of the likely intendedHello ${payload.foo}`.
  2. At docs/triggering.mdx:572, childTask2 references a bare bar variable (return bar + 1) which is not in scope — the parameter is payload: { bar: number }, so it should be return payload.bar + 1.

These same errors are repeated in the batch.triggerByTask section at lines 601 and 608. These are pre-existing issues not introduced by this PR, but they could mislead users copying the examples.

(Refers to lines 562-574)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ export const parentTask = task({
{ id: "child-task-2", payload: { bar: 42 } }, // 👈 The payload is typed correctly based on the task `id`
]);

for (const result of results) {
for (const result of results.runs) {
if (result.ok) {
// 👇 Narrow the type of the result based on the taskIdentifier
switch (result.taskIdentifier) {
Expand Down