Skip to content
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

Regression: root-level invoked services not stopped after reaching final state #3522

Closed
with-heart opened this issue Aug 15, 2022 · 2 comments · Fixed by #3523
Closed

Regression: root-level invoked services not stopped after reaching final state #3522

with-heart opened this issue Aug 15, 2022 · 2 comments · Fixed by #3523
Assignees
Labels

Comments

@with-heart
Copy link
Contributor

Description

When an interpreted machine reaches a final state, services invoked at the root level are no longer stopped.

#3126 changed the way the interpreter is stopped when this.state.done, calling the new _stop method where previously stop was called. stop handles stopping all children:

this.children.forEach((child) => {
if (isFunction(child.stop)) {
child.stop();
}
});

Expected result

When a service reaches a final state, all invoked services are stopped.

Actual result

When a service reaches a final state, services invoked at the root are not stopped.

Reproduction

https://codesandbox.io/s/kind-diffie-ewx8qk?file=/src/index.ts

Additional context

Reproduction of previous behavior (xstate@4.32.1): https://codesandbox.io/s/modern-rain-4serhm

@Andarist
Copy link
Member

Thank you for the report, It got fixed by #3523 and the new release is already out.

@with-heart
Copy link
Contributor Author

@Andarist You're the best! Ty 💖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants