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

Bug: eventless transitions in parallel states not taken anymore when starting interpreter from given state #3544

Closed
fparga opened this issue Aug 24, 2022 · 3 comments · Fixed by #3599
Assignees
Labels

Comments

@fparga
Copy link

fparga commented Aug 24, 2022

Description

Eventless transitions in parallel state are not taken anymore when interpreter is started from a given state.

Expected result

Eventless transitions should always be taken.

For example, in the linked reproduction sandbox, the expected result is:

state.value == {"b":{"x":"bar","y":{}}} 

This is the result obtained with xstate version < 4.33.0

Actual result

The eventless transition in example is not taken anymore with xstate version >= 4.33.0.

Instead, we get:

state.value == {"b":{"x":"foo","y":{}}} 

Reproduction

https://codesandbox.io/s/affectionate-thunder-esq8rn?file=/src/index.js

Additional context

It looks like a regression introduced in version 4.33.0.

@fparga fparga added the bug label Aug 24, 2022
@fparga fparga changed the title Bug: eventless transitions in parallel states not taken when starting interpreter from given state Bug: eventless transitions in parallel states not taken anymore when starting interpreter from given state Aug 24, 2022
@Andarist
Copy link
Member

Thanks for the repro case! We really appreciate it - I'm gonna take a look at this soon.

@Andarist
Copy link
Member

Andarist commented Aug 25, 2022

I've found the culprit behind this regression. It seems that this case here actually has been implicitly relying on a shared reference to configuration. Your issue depends on the resolved~ configuration but the algorithm mutates entrySet here (they were pointing to the same array prior 4.33)

I'll try to figure out an improved algorithm for this.

@fparga
Copy link
Author

fparga commented Sep 15, 2022

Awesome, thank you @Andarist!

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