agents
agents copied to clipboard
Can onStateUpdate include the prev state?
I have a case where I'd like to handle specific types of updates, so if the state is an object, i want to handle a change to a field.
However, I think I need access to the previous state in order to see if the field had changed.
Proposed:
onStateUpdate(state: State | undefined, prevState: State | undefined, source: Connection | "server") {
if (state?.field !== prevState?.state) {
// do something
}
}