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

[v5] Remove interpreter.children #2840

Merged
merged 7 commits into from
Dec 8, 2021
Merged

Conversation

davidkpiano
Copy link
Member

This PR removes interpreter.children in favor of interpreter.state.children (redundant).

@changeset-bot
Copy link

changeset-bot bot commented Nov 27, 2021

🦋 Changeset detected

Latest commit: fc5ca7b

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

This PR includes changesets to release 8 packages
Name Type
xstate Major
@xstate/graph Major
@xstate/immer Major
@xstate/inspect Major
@xstate/react Major
@xstate/svelte Major
@xstate/test Major
@xstate/vue Major

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

@davidkpiano davidkpiano changed the base branch from main to next November 27, 2021 23:15
@ghost
Copy link

ghost commented Nov 28, 2021

CodeSee Review Map:

Review these changes using an interactive CodeSee Map

Review in an interactive map

View more CodeSee Maps

Legend

CodeSee Map Legend

if (!child) {
return;
}

this.children.delete(childId);
this.forwardTo.delete(childId);
delete this.state.children[childId];
Copy link
Member

Choose a reason for hiding this comment

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

This probably should be refactored to avoid mutation of this.state - I think most people treat this as immutable. Maybe grabbing the actor ref to stop within machine APIs~ and embedding that in the action would help? This way we wouldn't have to access this here by ID

Copy link
Member Author

@davidkpiano davidkpiano Nov 30, 2021

Choose a reason for hiding this comment

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

Let's address this in a separate PR. This isn't part of this PR's changes.

The tricky thing is that the state.children then needs to change as part of the stop(...) action, and currently, actions can only affect the context, and not other parts of the state, so this requires a lot more thought. I agree it should change, though.

Copy link
Member

Choose a reason for hiding this comment

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

Do we have any ticket anywhere to track this?

Copy link
Member Author

Choose a reason for hiding this comment

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

@Andarist
Copy link
Member

Andarist commented Dec 1, 2021

Let's not forget about a changeset here - this is a pretty big user-facing change.

@davidkpiano davidkpiano merged commit 3909877 into next Dec 8, 2021
@davidkpiano davidkpiano deleted the v5/remove-interpreter-children branch December 8, 2021 17:51
@github-actions github-actions bot mentioned this pull request Dec 8, 2021
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