big-brain icon indicating copy to clipboard operation
big-brain copied to clipboard

Success state sometimes not run

Open isidornygren opened this issue 1 year ago • 1 comments

Hello and thanks for an amazing library. I'm running into an issue when using a Success | Failure matcher for action cleanup:

   ...
   ActionState::Cancelled => {
      *state = ActionState::Failure;
   }
   ActionState::Failure | ActionState::Success => {
      commands.entity(*actor).remove::<SomeMarker>();
   }

Which I assumed would run if the action failed or successfully completed at any point. However, after doing some test runs I can see that an action can successfully complete without running the cleanup routine sometimes, but I'm not sure why. I'll investigate a bit on my end and report if I find any further clues.

isidornygren avatar Jul 25 '24 09:07 isidornygren

I'm pretty sure this is an oversight, but it's been a while. It seems pretty reasonable to me to expect either Failure or Success to always run at least once. I'll totally take a PR for this.

zkat avatar Jul 25 '24 17:07 zkat