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

Switch ordering between life-cycle functions and state event #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cstim
Copy link
Contributor

@cstim cstim commented Jun 15, 2022

Description

The ordering in the transition functions previous was that first the 'state' event was emitted (to the outside), secondly the class-internal on life-cycle function was called. At the cybus software, that turned out to be the root cause of some problem, because there may be events that should immediately be followed by other class-internal action, even before any outside event listener is notified about the state change. In the previous ordering that was impossible. By switching this to first call the class-internal life-cycle functions and then emit the event, it ensures that the class stays in ownership of its own state and its own state interpretation.

How has this been tested?

We changed this to fix some remaining bug in the cybus software in CYB-3488 (2022-03-07, appearing in release 1.0.78), and it has been in active use since then, so I would conclude that it works fine.

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

Successfully merging this pull request may close these issues.

1 participant