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
}
}
yeah we could do this. might have to put prevState as the last arg so it's not a breaking change. wanna make a PR?
@kchro3 is it something that you still need?
Closing due to no activity. Let us know if you'd be up for doing this and if you still need it.