Pass immutable run-state snapshot to onTriggeredRun
Co-authored-by: Eric Allam <eric@trigger.dev>
This commit is contained in:
@@ -809,7 +809,7 @@ describe("TriggerChatTransport", function () {
|
||||
onTriggeredRun: async function onTriggeredRun(state) {
|
||||
await sleep(1);
|
||||
observedRunId = state.runId;
|
||||
observedState = { ...state };
|
||||
observedState = state;
|
||||
callbackCompleted = true;
|
||||
},
|
||||
});
|
||||
|
||||
@@ -177,7 +177,9 @@ export class TriggerChatTransport<
|
||||
|
||||
if (this.onTriggeredRun) {
|
||||
try {
|
||||
await this.onTriggeredRun(runState);
|
||||
await this.onTriggeredRun({
|
||||
...runState,
|
||||
});
|
||||
} catch {
|
||||
// Ignore callback errors so chat streaming can continue.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user