-
-
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
[v5] systemId
for spawn()
#3990
Conversation
🦋 Changeset detectedLatest commit: 0e1f370 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 |
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 0e1f370:
|
"--config", | ||
"jest.config.js", | ||
"--no-cache", | ||
"--testTimeout=2147483647" |
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.
Sorry @Andarist, I think this was a bad idea. With this test timeout, any failing test will now hang for a long time instead of timing out, making it very difficult to determine which test is failing.
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.
Let's revert this change from here. I opened a PR here to add a second launch script - there will be one with the timeout and one without it.
@@ -0,0 +1,19 @@ | |||
--- | |||
'xstate': major |
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.
'xstate': major | |
'xstate': patch |
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.
Wouldn't this technically be minor
?
Also I've been wondering about how this works with the next
branch. When I ran changesets add
for #3997, it just assumed it was a major
change for some reason.
Do the different versions have any effect when it's in prerelease mode?
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.
Wouldn't this technically be minor?
That works too. I suggest patch
here since this was an oversight on our part. This kinda should be supported from the start. I don't mind using minor though - we'll have to clean up this changeset before releasing final v5 anyway (this particular changeset is only relevant for the prerelease)
When I ran changesets add for #3997, it just assumed it was a major change for some reason.
That's weird, it should allow u to select the type.
Do the different versions have any effect when it's in prerelease mode?
It's just for grouping them together. And all pending changesets are used to determine the next version - if we didn't have any major changesets then we would end up with xstate@4.38.0-beta.11
(or similar).
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.
Thanks for the explanation! Makes sense 👍
You can now add a `systemId` to spawned actors to reference them anywhere in the system. | ||
|
||
```ts | ||
const machine = createMachine({ | ||
// ... | ||
context: ({ spawn }) => ({ | ||
actorRef: spawn( | ||
createMachine({ | ||
// ... | ||
}), | ||
{ systemId: 'actorRef' } | ||
) | ||
}) | ||
}); | ||
``` |
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.
Showing how to reference the actor by systemId
elsewhere in the system would add a lot of value here
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.
Will do this in the docs
This PR adds
systemId
to the 2nd argument ofspawn(logic, options?)
.