mirror of
https://github.com/langchain-ai/langgraphjs.git
synced 2026-07-23 01:26:57 -04:00
fix(sdk): mutate function receiving incorrect previous value (#1669)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@langchain/langgraph-sdk": patch
|
||||
---
|
||||
|
||||
Fix mutate function in `onCustomEvent` and in `onUpdateEvent` receiving incorrect previous value
|
||||
@@ -163,7 +163,10 @@ export class StreamManager<
|
||||
return (
|
||||
update: Partial<StateType> | ((prev: StateType) => Partial<StateType>)
|
||||
) => {
|
||||
const prev = { ...historyValues, ...this.state.values };
|
||||
const prev = {
|
||||
...historyValues,
|
||||
...(this.state.values ?? [null, "stream"])[0],
|
||||
};
|
||||
const next = typeof update === "function" ? update(prev) : update;
|
||||
this.setStreamValues({ ...prev, ...next }, kind);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user