Skip to content
New issue

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

PermitDynamic and reentry #604

Open
hooligan495 opened this issue Nov 2, 2024 · 0 comments
Open

PermitDynamic and reentry #604

hooligan495 opened this issue Nov 2, 2024 · 0 comments

Comments

@hooligan495
Copy link

hooligan495 commented Nov 2, 2024

A change made in version 5.14 impacted permitDynamic's reentry logic. This was fixed/changed in 5.16 (see issue #565) In reading this change and it's discussion. The XMLDocs aren't clear that PermitDynamic will in fact call OnEntry with multiple activations of the same trigger.
@mclift looks like you made the final decision here. I must admit that this is confusing. The front of the page documentation says states are not reentrant by default. It appears to me (and I just might be flat out wrong) that there is a mixed mode of behavior here. The facts for the 5.16 change read like so:

`

        sm.Configure(State.A)
            .PermitDynamic(Trigger.X, () => State.A)
            .OnEntry(() => onEntryInvoked = true)
            .OnEntryFrom(Trigger.X, () => onEntryFromInvoked = true)
            .OnExit(() => onExitInvoked = true);
        await sm.FireAsync(Trigger.X);

`

I don't read this as re-entrant but more when you read this example and consider the front page documentation.. that both of these would be called just the first time you enter the state.

I recently created a hierarchical state and set of substates and was using permit dynamic to sequence through my substates. In my example I want to NOT have my substates be reentrant, if I am in state A and I get a trigger that says I need to go to state A I would like for OnEntry function(S) to not be called. Is it possible to make this happen through stateless? Otherwise I'm going to have to code my OnEntry function to manage a form of state in the Entry Function.. which just feels odd to me...

I hope I am speaking in a somewhat articulate manner here? If you could give some guidance that'd be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant