You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently there's inconsistent behavior when using updateState(). When updating a single property, it appears to replace the entire state object rather than patching it:
console.log(session.state)// { userName: 'God', colour: 'Green' }async(input)=>{ai.currentSession().updateState({colour: input.colour,});return`colour updated to ${input.colour}`;}console.log(session.state)// { colour: 'Green' } // userName was cleared
The current workaround is to manually spread the existing state:
pavelgj
changed the title
[js/core/session] session updateState should patch the state instead of replace
Feature request: session updateState should patch the state instead of replace
Dec 2, 2024
Description
Currently there's inconsistent behavior when using
updateState()
. When updating a single property, it appears to replace the entire state object rather than patching it:The current workaround is to manually spread the existing state:
It should be changed to patch
The text was updated successfully, but these errors were encountered: