Skip to content

Commit c64b9d6

Browse files
docs: add isReplay to context docs and replaying page
Co-Authored-By: nick <55853254+nicktrn@users.noreply.github.com>
1 parent 38fc9e0 commit c64b9d6

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

docs/context.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ export const parentTask = task({
8181
<ResponseField name="isTest" type="boolean">
8282
Whether this is a [test run](/run-tests).
8383
</ResponseField>
84+
<ResponseField name="isReplay" type="boolean">
85+
Whether this run is a [replay](/replaying) of a previous run.
86+
</ResponseField>
8487
<ResponseField name="createdAt" type="date">
8588
The creation time of the task run.
8689
</ResponseField>

docs/replaying.mdx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,21 @@ description: "A replay is a copy of a run with the same payload but against the
3030
</Tab>
3131
</Tabs>
3232

33+
### Detecting replays in your task
34+
35+
You can check if a run is a replay using the [context](/context) object:
36+
37+
```ts
38+
export const myTask = task({
39+
id: "my-task",
40+
run: async (payload, { ctx }) => {
41+
if (ctx.run.isReplay) {
42+
// This run is a replay of a previous run
43+
}
44+
},
45+
});
46+
```
47+
3348
### Replaying using the SDK
3449

3550
You can replay a run using the SDK:

0 commit comments

Comments
 (0)