You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a state machine with some parallel states. When defining reenter: true in a state transion of one of them, all the siblings also reenter.
import{createMachine,assign,fromPromise,setup}from"xstate";exportconstmachine=createMachine({id: "reentrytest",type: "parallel",context: {numberOfTimesParallelNodeIsEntered: 0,},states: {someStateWithReentry: {entry: ()=>voidconsole.log("I expect this to be called twice"),initial: "a",states: {a: {},b: {},},on: {REENTER_A: {target: ".a",reenter: true,},},},parallelStateWithNoReentry: {entry: [assign({numberOfTimesParallelNodeIsEntered: ({ context })=>context.numberOfTimesParallelNodeIsEntered+1,}),({ context })=>context.numberOfTimesParallelNodeIsEntered>1&&console.log("Oops, I definitely don't expect this entry action to be called a second time!"),],initial: "c",states: {c: {on: {GO_TO_D: {target: "d",},},},d: {},},},},});
XState version
XState version 5
Description
Hey! Thank you for all your continued work! ❤️🫡
I have a state machine with some parallel states. When defining
reenter: true
in a state transion of one of them, all the siblings also reenter.Expected result
Only the node whose state transition has defined
reenter: true
should reenter if I understand the docs correctly https://stately.ai/docs/transitions#re-enteringActual result
All parallel sibling state nodes also reenter
Reproduction
https://codesandbox.io/p/sandbox/vigorous-grass-7xrhqc?file=%2Fsrc%2Fmachine.ts%3A32%2C23&workspaceId=ws_6NRGN9nh2CKAFqdS5fatLX
Additional context
Latest @xstate/react and xstate
The text was updated successfully, but these errors were encountered: