-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] Nested tree machines final state #100
Comments
Can you share some example code or a link to codesandbox / codepen? |
@HipsterBrown output is
when expected output is
|
@matthewp any thoughts? |
It appears the invoke function type sends the let invokeType = {
enter(machine, service, event) {
this.fn.call(service, service.context, event)
.then(data => service.send({ type: 'done', data }))
.catch(error => service.send({ type: 'error', error }));
return machine;
}
}; My guess is this could be addressed by updating the |
Yes, this does sound like a bug. I can't look at it today but will try to do shortly (if someone else wants to try and do a PR that would be great too). |
@matthewp const machineToThen = machine => function(ctx, ev) {
return {
then: resolve => {
this.child = interpret(machine, s => {
- this.onChange(this);
+ if (this.child !== s) this.onChange(s);
+ else this.onChange(this);
if(s.machine.state.value.final) {
delete this.child;
resolve(s.context);
}
}, ctx, ev);
return { catch: identity };
}
};
}; |
When there is a tree of nested state machines, when the very child final state is reached it goes straight to the root machine
The text was updated successfully, but these errors were encountered: