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
The "ping pong" machine example doesn't work when predictableActionArguments is set to true: https://xstate.js.org/docs/guides/communication.html#invoking-callbacks.
predictableActionArguments
true
I copy/pasted (and instrumented the code):
const { createMachine, interpret, send } = require('xstate'); const pingPongMachine = createMachine({ predictableActionArguments: true, id: 'pinger', initial: 'active', states: { active: { invoke: { id: 'ponger', src: (context, event) => (callback, onReceive) => { console.log('ponger init') // Whenever parent sends 'PING', // send parent 'PONG' event onReceive((e) => { if (e.type === 'PING') { console.log('ponger done') callback('PONG'); } }); } }, entry: send({ type: 'PING' }, { to: 'ponger' }), on: { PONG: { target: 'done' } } }, done: { type: 'final' } } }); interpret(pingPongMachine) .onDone(() => console.log('done!')) .start();
Expected output:
ponger init ponger done done!
Actual output:
ponger init
https://codesandbox.io/s/lucid-gauss-hnuq18?file=/src/index.js
If you set predictableActionArguments to false then we get the expected output.
false
This was observed in v4.33.3.
In v4.33.2 we get the expected output regardless of the value of predictableActionArguments.
The text was updated successfully, but these errors were encountered:
Andarist
Successfully merging a pull request may close this issue.
Description
The "ping pong" machine example doesn't work when
predictableActionArguments
is set totrue
:https://xstate.js.org/docs/guides/communication.html#invoking-callbacks.
I copy/pasted (and instrumented the code):
Expected result
Expected output:
Actual result
Actual output:
Reproduction
https://codesandbox.io/s/lucid-gauss-hnuq18?file=/src/index.js
Additional context
If you set
predictableActionArguments
tofalse
then we get the expected output.This was observed in v4.33.3.
In v4.33.2 we get the expected output regardless of the value of
predictableActionArguments
.The text was updated successfully, but these errors were encountered: