From deeb783f8b15c2a0e9de338feb12f9b816ddf3f3 Mon Sep 17 00:00:00 2001 From: Hannah Mudge Date: Thu, 6 Apr 2023 17:42:56 -0600 Subject: [PATCH] [Dashboard] [Controls] Fix inherited input race condition (#154293) Closes https://github.com/elastic/kibana/issues/154071 ## Summary **Before:** Before this PR, the dashboard's children would start being loaded/initialized **before** the control group was necessarily ready - this caused a race condition where, when the children tried to get their inherited input, if the control group wasn't quite ready yet, then they would not receive the control group's filters for their initialization. So, on first load of a dashboard with one or more controls with selections, it was possible for the contents of a dashboard to **not reflect** the control selections, like so: ![Screenshot 2023-04-06 at 1 54 16 PM](https://user-images.githubusercontent.com/8698078/230481821-624221ff-cbee-4288-af24-c7cede312f14.png) This obviously caused flakiness for the drilldown test, because if the children in the source dashboard did not receive the inherited input from the control group, then the drilldown **also** wouldn't pass down the control group filters. **After:** To avoid this race condition, the dashboard now waits until the control group is ready **before** the children can be loaded - so, when the children try to get their inherited input, it should **always** contain the control group's output filters: ![Screenshot 2023-04-06 at 1 59 15 PM](https://user-images.githubusercontent.com/8698078/230484589-a43c3292-3a6b-4f07-8a89-8ec181141024.png) ### Flaky Test Runner ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --- .../dashboard_container/embeddable/dashboard_container.tsx | 6 +++--- .../group3/drilldowns/dashboard_to_dashboard_drilldown.ts | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/plugins/dashboard/public/dashboard_container/embeddable/dashboard_container.tsx b/src/plugins/dashboard/public/dashboard_container/embeddable/dashboard_container.tsx index 4c351177113d90..95034247b8d917 100644 --- a/src/plugins/dashboard/public/dashboard_container/embeddable/dashboard_container.tsx +++ b/src/plugins/dashboard/public/dashboard_container/embeddable/dashboard_container.tsx @@ -311,14 +311,14 @@ export class DashboardContainer extends Container { before(async () => { log.debug('Dashboard Drilldowns:initTests');