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

Further errors-related adjustments #4492

Merged
merged 6 commits into from
Nov 29, 2023
Merged

Further errors-related adjustments #4492

merged 6 commits into from
Nov 29, 2023

Conversation

Andarist
Copy link
Member

No description provided.

Copy link

changeset-bot bot commented Nov 24, 2023

🦋 Changeset detected

Latest commit: f63144b

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

This PR includes changesets to release 1 package
Name Type
xstate 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

Copy link

codesandbox-ci bot commented Nov 24, 2023

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 f63144b:

Sandbox Source
XState Example Template Configuration
XState React Template Configuration

case 'done':
// it's disputable if `next` observers should be notified about done snapsots
Copy link
Member Author

Choose a reason for hiding this comment

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

While somewhat disputable - I'm coming to the realization that maybe it's just better in our case. We don't necessarily have to maintain 1 to 1 semantics with RxJS and we can treat done snapshots as regular snapshots, just with a small addition of executing complete right after updating our internal state with one.

Comment on lines +562 to +566
// TODO: atm children don't belong entirely to the actor so
// in a way - it's not even super aware of them
// so we can't stop them from here but we really should!
// right now, they are being stopped within the machine's transition
// but that could throw and leave us with "orphaned" active actors
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 a fairly big concern. The core of the problem is outlined in this comment. Children's lifetime is somewhat related to the parent actor... but that parent actor alone doesn't really manage them. On top of that, children are exclusive to machines today.

To somewhat remedy that I could "duplicate" some of the try/catches within the StateMachine and update the snapshots and things there. We can't remove those try/catches from the Actor though. Other logic types might not be as nice and they might just throw.

Alternatively, we could make an assumption that actor logics can't really throw and that the error handling is their responsibility... that's kinda a big assumption though (even if we'd document this)

Comment on lines 1653 to 1655
// TODO: we should likely only allow transitions selected by very explicit descriptors
// `*` shouldn't be matched, likely `xstate.error.*` shouldnt be either
// what about `xstate.error.actor.*`? what about `xstate.error.actor.todo.*`?
Copy link
Member Author

Choose a reason for hiding this comment

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

related to: #2935 (comment)

@Andarist Andarist changed the title Further errors-related adjuments Further errors-related adjustments Nov 24, 2023
Copy link
Member

@davidkpiano davidkpiano left a comment

Choose a reason for hiding this comment

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

This LGTM - just need to adjust (un-skip + refactor) the tests

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.

2 participants