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
Description
A combinatorial machine enters an infinite loop when a root service sends back an event that updates the context.
constmachine=createMachine({id: "machine",context: {name: ""},invoke: {id: "name-observer",src: ()=>(sendBack)=>{// This service is re-initialized on each context change if `states` is not set on the machine.// This causes it to send back the SET_NAME event again, and we enter an infinite loop.sendBack({type: "SET_NAME",name: "John"});}},on: {SET_NAME: {actions: assign((ctx,{ name })=>({ name }))}}// if the following is uncommented, the machine does not go into infinite loop:// initial: "inactive",// states: {// inactive: {}// }});
Expected Result
Combinatorial machines should behave like normal machines. The root invoke service should not be re-initialized on each machine change.
Description
A combinatorial machine enters an infinite loop when a root service sends back an event that updates the context.
Expected Result
Combinatorial machines should behave like normal machines. The root invoke service should not be re-initialized on each machine change.
Reproduction
https://codesandbox.io/s/vigilant-butterfly-bi1ei?file=/src/index.js
Additional context
XState 4.19.1
The text was updated successfully, but these errors were encountered: