Hi everyone! I have an example here with some instructions in it. I see console logs from actions running, but they dont take affect. It seems like a guard may be affecting in a case where maybe it should not be? (but only when 2 events happen one after the other) Or perhaps I am abusing xstate? I tried to make a simplified version of something I have in a project. When someone has a moment, can you please take a look? https://codesandbox.io/s/objective-cache-46f786?file=/src/App.vue
#[v5] actions run but not applied, is this the expected behavior?
1 messages · Page 1 of 1 (latest)
This may be a bug (cc. @weak hemlock (I'm tagging you a lot today hah))
Thanks for looking at that. I believe the code in my project worked as expected at one time, but yesterday I noticed the issue.
Can you also file an issue on https://github.com/statelyai/xstate/issues/new ?
the fact that you are temporarily in the "blocked" state here is the desired outcome, right?
to get it right - the repro case would be:
- click Send Increase (the button above)
- click Send reset, then increate (the button below)
- actual 1, expected 2
did I get it right?
hm, actually - no
😅
I'm not sure where is the confusion - it seems to me that it works fine so perhaps I'm not seeing something here
could u go through this step by step to explain what do u think should happen at each step and where your expectation is not met?
Yes its temporarily in the blocked state.
- Click the Send increase button (which set counter to 1 and moves to blocked)
- Click the Send rest, then increase, which calls the reset related actions and shows console logs, but they don't seem to affect the state or context.
Actually I found a case where count was decremented, which there is no code for. I waited for the timeout & did the steps again.
But that second button resets both to idle and the counter to 0 and increments again
So we end up somewhat where we started
It’s going from 1 to 0 to 1
Do you see this from clicking the Send increase button and then the Send reset, then increase button?
count increased logged 2 times, but its 1
if I click the buttons in the same order again, I see count become 2, then 1 again
(after the blocked state is auto removed)
Yes but that’s OK right?
That sounds ok too
U start with 1, increase it by 1 to 2. Then reset to 0 and increase by 1 to 1
hmm, I see what you mean. gonna look back at the local machine I was trying to copy in a simple way.
I think this is going to be too much to simplify down, I may try refactoring the machine in the project