-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Alerting flyouts don't handle changing props particularly well #83417
Comments
Pinging @elastic/kibana-alerting-services (Team:Alerting Services) |
Alerts flyout was changed from the show/hide approach to the render/don't-render approach with this PR |
Awesome. |
Yes, I believe we discussed just addressing #2 from the issue description by improving type checking since #1 has been addressed.
|
It looks like some work has already been done to tighten up the typings as part of this PR. Is that sufficient to resolve this issue? There's more that could be done in terms of breaking apart the components but at this point, that seems more like a tech debt issue than a bug that needs to be addressed immediately. |
I think that's a fair assessment. Can we update the description at the top to reflect that? |
Some items from the original issue description have been addressed. Remaining tech debt:
Original issue description
I've encountered a range of UI bugs caused by the state between
AlertAdd
andAlertForm
going out of sync.This seems to be caused by race conditions between the
useState
in these two components and is hard to reliably reproduce (I've been able to reproduce it in Uptime quite regularly due to their unique method of selecting an alertTypeId, but it isn't only there), but is definitely present.I'd recommend abandoning the show/hide approach, which is error prone, and instead going down a render/dont-reender approach which would mean we don't need to maintain state as often as we do now.
While this is, potentially, less performant if the flyout is constantly created/destoryed, this seems unlikely as we don't expect users to regularly create/modify alerts at a high rate. This means that we might actually find this to be more performant as we would avoid instantiating these components in the first place for most users (unlike the current implementation).
A couple of notes:
I've already addressed this in that Connectors flyouts in TriggersActionsUI (we now only render these components when needed) in this PR: [Actions & Connectors] removes Connector flyouts after usage #82126. Making the same change in alerting would be a little harder as it's used throughout solutions - we'll have to work with them to address this.
Some of these bugs are hidden from sight because our type checking isn't quite true to reality (for example, this cast causes one of these state issues to be hidden). This is often because our components are trying to do too many things at once (AlertsForm is both the form for choosing an AlertType and wraps the behaviour for rendering after a type has been selected), and could be addressed by breaking these down into smaller, more specific, components. This should also help in long term maintenance and sustainability of our codebase. 🎉
The text was updated successfully, but these errors were encountered: