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

[12.x] Fix support for adding custom observable events from traits #55286

Draft
wants to merge 3 commits into
base: 12.x
Choose a base branch
from

Conversation

willrowe
Copy link
Contributor

@willrowe willrowe commented Apr 5, 2025

This delays the observe call in the boot method for the HasEvents trait until after the model has finished booting so that any custom events registered by other traits are available to be matched up to observer class methods.

This fixes the initial issue that was discussed in #53607

willrowe added 3 commits April 5, 2025 15:57
- This ensure that all custom events have been registered by any traits first.
- It also prevents a new instance of the model from being created by the call to `observe` too early, since an instance created before booting has finished would be in an inconsistent state due to not all of the trait boot methods being run yet and not all of the initializer methods would be registered yet, so they would not be run either.
@willrowe willrowe marked this pull request as draft April 5, 2025 21:11
@willrowe
Copy link
Contributor Author

willrowe commented Apr 5, 2025

There are some funky issues with the tests and listening for the booted event. I will have to take another look on Monday. Setting as draft for now.

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