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

Fixed an issue with tags not being set correctly after sending an event to a machine that didn't result in selecting any transitions #2173

Merged
merged 1 commit into from
May 5, 2021

Conversation

Andarist
Copy link
Member

@Andarist Andarist commented May 4, 2021

Fixes #2172

When we don't select any transitions then we just return here:
https://github.com/davidkpiano/xstate/blob/64ab1150e0a383202f4af1d586b28e081009c929/packages/core/src/StateNode.ts#L1280-L1282
but tags are set later on, here:
https://github.com/davidkpiano/xstate/blob/64ab1150e0a383202f4af1d586b28e081009c929/packages/core/src/StateNode.ts#L1328-L1330

So this didn't have a chance to be set correctly for the fixed test case.

…nt to a machine that didn't result in selecting any transitions
@Andarist Andarist requested a review from davidkpiano May 4, 2021 15:28
@changeset-bot
Copy link

changeset-bot bot commented May 4, 2021

🦋 Changeset detected

Latest commit: 64ab115

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
xstate Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@@ -1263,7 +1263,8 @@ class StateNode<
configuration: resolvedConfiguration,
transitions: stateTransition.transitions,
children,
done: isDone
done: isDone,
tags: currentState?.tags
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is kinda funky since we'll override this later on when we match some transition and this is outdated at the time of creating this nextState but it was an easy-to-do thing now - this happens in our internals, so hopefully this shouldn't be that observable.

We might call some expressions with that outdated info when processing the micro queue but that might be partially expected (this part already works in a different way than in SCXML since it updates the configuration as it goes and we don't do that).

@davidkpiano davidkpiano merged commit bed20b0 into master May 5, 2021
@github-actions github-actions bot mentioned this pull request May 5, 2021
@Andarist Andarist deleted the fix/tags-not-selected branch March 22, 2023 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tags are not set on all updates when having an async callback service
2 participants