Bug
When using actors & useMachine with StrictMode React runs twice which might be causing to have 2 instances of the machine. I think it's causing the actor to lose the right reference to the parent machine.
Should work fine with StrictMode.
Warning: Event "fetch_SUCCESS" was sent to uninitialized service "fetchMachine" and is deferred. Make sure .start() is called for this service.
Don't know what the potential fix is since I'm not certain what is causing the reference to be lost.
I also strongly encourage you to create a pull request if you are confident in the potential fix.
https://codesandbox.io/s/great-haibt-ezdz5
If you remove StrictMode it works fine.
I don't think this has to do with StrictMode. I'm getting the same warning without StrictMode in my code. Fork of your sandbox: https://codesandbox.io/s/hopeful-night-1c7so
Ok, so we deal with 2 different reports here.
@Jpadilla1 this is a combination of:
.start() gets called. This is going to change in the future - https://github.com/davidkpiano/xstate/issues/534#issuecomment-510888732@ReasonableDeveloper this is actually expected - when a machine reaches its final state it's considered to be "done" as per - https://www.w3.org/TR/scxml/#final :
When the state machine reaches the
child of an element, it must terminate.
Most helpful comment
Ok, so we deal with 2 different reports here.
@Jpadilla1 this is a combination of:
.start()gets called. This is going to change in the future - https://github.com/davidkpiano/xstate/issues/534#issuecomment-510888732@ReasonableDeveloper this is actually expected - when a machine reaches its final state it's considered to be "done" as per - https://www.w3.org/TR/scxml/#final :