Access the context variable from a inner state's action #5115
-
I am now working on a nested state machine that looks like this
My assumption is that the |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
I have made some progress on this project and I think my the question should be changed to How to assign/reset the context to a specific value on entry. Because it seems that the context value does not change on the entry event. |
Beta Was this translation helpful? Give feedback.
-
I have found that the same issue happened back in 2020. |
Beta Was this translation helpful? Give feedback.
-
As I understand, context is shared. From the looks of it, the issue could be that states: {
active: {
entry: () => { // 👈 The curly braces here result in nothing being returned by this closure
assign({
count: 10
});
},
after: {
'1000': [{
target: 'inactive'
}]
}
}, Perhaps the version below would work? states: {
active: {
entry: assign({
count: 10
}),
after: {
'1000': [{
target: 'inactive'
}]
}
}, |
Beta Was this translation helpful? Give feedback.
As I understand, context is shared.
From the looks of it, the issue could be that
assign
is not being returned from the scope:Perhaps the version below would work?