-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 parallel region reentrancy #3422
Conversation
🦋 Changeset detectedLatest commit: 5386d60 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
👇 Click on the image for a new way to code review
Legend |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 5386d60:
|
@@ -1608,7 +1608,7 @@ class StateNode< | |||
return this.resolveTransition( | |||
{ | |||
configuration, | |||
entrySet: configuration, | |||
entrySet: [...configuration], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since I've added another situation in which transition.entrySet
might be mutated I had to make a copy here to avoid configuration
being affected by this mutation. This was required by this test:
xstate/packages/core/test/actions.test.ts
Lines 715 to 735 in 1eff5ca
it('should call each exit handler only once when the service gets stopped', () => { | |
const actual: string[] = []; | |
const machine = createMachine({ | |
exit: () => actual.push('root'), | |
initial: 'a', | |
states: { | |
a: { | |
exit: () => actual.push('a'), | |
initial: 'a1', | |
states: { | |
a1: { | |
exit: () => actual.push('a1') | |
} | |
} | |
} | |
} | |
}); | |
interpret(machine).start().stop(); | |
expect(actual).toEqual(['a1', 'a', 'root']); | |
}); |
Without this line it was calling exit actions multiple times as the mutated configuration contained duplicated state nodes
1eff5ca
to
5386d60
Compare
fixes https://discord.com/channels/795785288994652170/809564609383890965/986216911459209226