Skip to content

Commit 9560ffd

Browse files
fix(chat): run block execution state loader (#5759)
1 parent 32de415 commit 9560ffd

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

apps/sim/lib/workflows/executor/execution-state.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,10 @@ describe('execution state lookup', () => {
148148
)
149149
mockMaterializeExecutionData
150150
.mockResolvedValueOnce({})
151-
.mockResolvedValueOnce({ executionState: EXECUTION_STATE })
151+
.mockImplementationOnce(async (executionData: Record<string, unknown>) => {
152+
const { traceStoreRef: _traceStoreRef, ...inlineValues } = executionData
153+
return { executionState: EXECUTION_STATE, ...inlineValues }
154+
})
152155

153156
const result = await getLatestExecutionStateWithExecutionId('workflow-1')
154157

@@ -160,7 +163,6 @@ describe('execution state lookup', () => {
160163
expect(mockMaterializeExecutionData).toHaveBeenNthCalledWith(
161164
1,
162165
{
163-
executionState: null,
164166
traceStoreRef: { id: 'value-2' },
165167
},
166168
{

apps/sim/lib/workflows/executor/execution-state.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,12 @@ export async function getLatestExecutionStateWithExecutionId(
142142
workflowId: row.workflowId,
143143
workspaceId: row.workspaceId,
144144
executionData: {
145-
executionState: row.executionState,
146-
[TRACE_STORE_REF_KEY]: row.traceStoreRef,
145+
...(row.executionState !== null && row.executionState !== undefined
146+
? { executionState: row.executionState }
147+
: {}),
148+
...(row.traceStoreRef !== null && row.traceStoreRef !== undefined
149+
? { [TRACE_STORE_REF_KEY]: row.traceStoreRef }
150+
: {}),
147151
},
148152
})
149153
if (state) return { executionId: row.executionId, state }

0 commit comments

Comments
 (0)