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

Fix State instance loosing it's context #440

Merged
merged 2 commits into from Apr 30, 2019
Merged

Fix State instance loosing it's context #440

merged 2 commits into from Apr 30, 2019

Conversation

farskid
Copy link
Contributor

@farskid farskid commented Apr 28, 2019

The problem

Currently, since the matches and toStrings methods are added to the prototype of State, the context of this will be lost in case of reassignment or object destructing.

const { matches } = machineState;

console.log(matches('some_state'));

Screenshot 2019-04-28 at 23 40 21

@davidkpiano
Copy link
Member

Thanks @farskid!! Can you write a quick test?

@farskid
Copy link
Contributor Author

farskid commented Apr 30, 2019

@davidkpiano Tests added to the State test suite.

@davidkpiano davidkpiano merged commit b9edf76 into statelyai:master Apr 30, 2019
@farskid farskid deleted the farskid/state-this-bug branch May 6, 2019 13:10
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.

None yet

2 participants