We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
XState version 5
self is available to the assign function, which makes it possible to pass the parent machine down to a spawned child machine:
assign({ spawnie: ({ self, spawn }) => spawn(someMachine, { input: { parent: self }, }) })
However self is not available when specifying the initial context of a machine:
context: ({ self, spawn }) => spawn(someMachine, { input: { parent: self }, })
It should be possible to deconstuct self in the context assignation
It doesn't work. When trying to use context.parent.send(...) from the spawned child:
Uncaught TypeError: Cannot read properties of undefined (reading 'send')
https://stackblitz.com/edit/github-keqmzr-y5weyb?file=src%2FfeedbackMachine.ts
No response
The text was updated successfully, but these errors were encountered:
self
context
Successfully merging a pull request may close this issue.
XState version
XState version 5
Description
self is available to the assign function, which makes it possible to pass the parent machine down to a spawned child machine:
However self is not available when specifying the initial context of a machine:
Expected result
It should be possible to deconstuct self in the context assignation
Actual result
It doesn't work. When trying to use context.parent.send(...) from the spawned child:
Uncaught TypeError: Cannot read properties of undefined (reading 'send')
Reproduction
https://stackblitz.com/edit/github-keqmzr-y5weyb?file=src%2FfeedbackMachine.ts
Additional context
No response
The text was updated successfully, but these errors were encountered: