-
-
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
[core] Transition function #4954
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 96f4ac4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
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 |
Just a reminder to remove commented lines before merging 💜 |
packages/core/src/StateNode.ts
Outdated
} | ||
if (typeof action === 'function' && !('resolve' in action)) { | ||
const type = `${this.id}|${kind}:${i}`; | ||
this.machine.implementations.actions[type] = action as any; |
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.
- I don't particularly like that we are writing to this object because it might be shared among different machines in some way and we might potentially leak things between instances
- i'd be wary of the code here, I wonder if this gets "fixed" somehow but I think there might run into stale closure hazard by resolving this here and caching it
Is there any update on the status of this, as I really need this with the deprecation of starting interpreter at a state on server side machines |
We're planning on merging it soon (cc. @Andarist ) |
…y resolved target
packages/core/src/actions/cancel.ts
Outdated
actorScope.system.scheduler.cancel(actorScope.self, resolvedSendId); | ||
// actorScope.system.scheduler.cancel(actorScope.self, resolvedSendId); |
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.
Should executeCancel
do something?
actorScope.defer(() => { | ||
const self = actorScope.self; | ||
actorScope.system.scheduler.schedule(self, self, event, delay, id); | ||
}); | ||
// actorScope.defer(() => { | ||
// const self = actorScope.self; | ||
// actorScope.system.scheduler.schedule(self, self, event, delay, id); | ||
// }); |
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.
Same thing here with executeRaise
… timestamp to raise and send actions
This PR adds the
transition(…)
function for returning a[snapshot, actions]
tuple given the machine, state, and event.Its main use-case is for server-side workflows and a pure way of handling state transitions for actor logic.