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
Is your feature request related to a problem? Please describe.
The StateManager returned by an EventReceiver's receiver provides methods to both get and set state. Currently, the value returned from getState function can be used to modify the state directly, which is likely unintended behavior. This issue might also exist in other parts of Eventrix.
// tasks.tsconstmarkAsDoneReceiver=newEventsReceiver(MARK_TASK_AS_DONE_EVENT_NAME,(eventName,{ id },stateManager)=>{consttasks=stateManager.getState('tasks');consttaskIndex=findIndex(tasks,(task)=>task.id===id);consttask=stateManager.getState(`tasks.${taskIndex}`);task.status='done';});
Describe the solution you'd like
To prevent unintended state modifications, the getState function should always return a deep copy of the relevant part of the store. This ensures that any changes made to the returned state do not affect the underlying store. (maybe using https://lodash.com/docs/4.17.15#cloneDeep)
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
The
StateManager
returned by anEventReceiver
's receiver provides methods to both get and set state. Currently, the value returned fromgetState
function can be used to modify the state directly, which is likely unintended behavior. This issue might also exist in other parts of Eventrix.Describe the solution you'd like
To prevent unintended state modifications, the
getState
function should always return a deep copy of the relevant part of the store. This ensures that any changes made to the returned state do not affect the underlying store. (maybe using https://lodash.com/docs/4.17.15#cloneDeep)The text was updated successfully, but these errors were encountered: