-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Controls] Fix initialization race condition #237726
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
[Controls] Fix initialization race condition #237726
Conversation
|
/ci |
|
/ci |
|
/ci |
|
@elasticmachine merge upstream |
|
/ci |
|
Pinging @elastic/kibana-presentation (Team:Presentation) |
| }); | ||
| }); | ||
|
|
||
| test('should not render DashboardGrid until controls are ready', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this test being removed? I don't think it should be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, that was a holdover from when I was using pauseFetch to fix the bug in the same PR. Restored this test.
…izationRaceCondition' into controls/fixInitializationRaceCondition
…izationRaceCondition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does filtersReadySubscription need to be clean up? The reason for the debounce is to give time for the filters to propagate to the control group. I don't think this is needed any more.
|
I removed the unnecessary debounce from filtersReadySubscription, but as a follow-up I'd like to look into removing it entirely and making the I decided not to do that in this PR because I'd like to keep this as stable as possible and that would introduce a lot of changes. Additionally, we'll be merging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for cleaning up these initialization conditions.
code review only
💚 Build Succeeded
Metrics [docs]Async chunks
History
|
|
@elasticmachine merge upstream |
|
Starting backport for target branches: 8.19, 9.2 |
Fixes a race condition in the controls initialization step. (cherry picked from commit e26e842)
💔 Some backports could not be created
Note: Successful backport PRs will be merged automatically after passing CI. Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
Fixes a race condition in the controls initialization step. (cherry picked from commit e26e842) # Conflicts: # src/platform/plugins/shared/controls/public/control_group/selections_manager.ts # src/platform/plugins/shared/controls/public/controls/data_controls/initialize_data_control.ts # src/platform/plugins/shared/controls/public/controls/data_controls/options_list_control/get_options_list_control_factory.test.tsx # src/platform/plugins/shared/dashboard/public/dashboard_api/control_group_manager.ts
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
Fixes a race condition in the controls initialization step. (cherry picked from commit e26e842) # Conflicts: # src/platform/plugins/shared/controls/public/control_group/selections_manager.ts # src/platform/plugins/shared/controls/public/controls/data_controls/data_control_manager.ts # src/platform/plugins/shared/controls/public/controls/data_controls/options_list_control/get_options_list_control_factory.test.tsx
Fixes a race condition in the controls initialization step. (cherry picked from commit e26e842) # Conflicts: # src/platform/plugins/shared/controls/public/control_group/selections_manager.ts # src/platform/plugins/shared/controls/public/controls/data_controls/data_control_manager.ts # src/platform/plugins/shared/controls/public/controls/data_controls/options_list_control/get_options_list_control_factory.test.tsx
# Backport This will backport the following commits from `main` to `9.2`: - [[Controls] Fix initialization race condition (#237726)](#237726) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Devon Thomson","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-10-14T19:46:49Z","message":"[Controls] Fix initialization race condition (#237726)\n\nFixes a race condition in the controls initialization step.","sha":"e26e842a094f95c0396bdd91f70ecd409956082d","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Presentation","loe:small","release_note:skip","impact:medium","backport:version","v9.2.0","v9.3.0","v8.19.6"],"title":"[Controls] Fix initialization race condition","number":237726,"url":"https://github.com/elastic/kibana/pull/237726","mergeCommit":{"message":"[Controls] Fix initialization race condition (#237726)\n\nFixes a race condition in the controls initialization step.","sha":"e26e842a094f95c0396bdd91f70ecd409956082d"}},"sourceBranch":"main","suggestedTargetBranches":["9.2","8.19"],"targetPullRequestStates":[{"branch":"9.2","label":"v9.2.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/237726","number":237726,"mergeCommit":{"message":"[Controls] Fix initialization race condition (#237726)\n\nFixes a race condition in the controls initialization step.","sha":"e26e842a094f95c0396bdd91f70ecd409956082d"}},{"branch":"8.19","label":"v8.19.6","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Devon Thomson <[email protected]>
Fixes a race condition in the controls initialization step.
# Backport This will backport the following commits from `main` to `9.1`: - [[Controls] Fix initialization race condition (#237726)](#237726) <!--- Backport version: 10.0.2 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Devon Thomson","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-10-14T19:46:49Z","message":"[Controls] Fix initialization race condition (#237726)\n\nFixes a race condition in the controls initialization step.","sha":"e26e842a094f95c0396bdd91f70ecd409956082d","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Presentation","loe:small","release_note:skip","impact:medium","backport:version","v9.2.0","v9.3.0","v9.1.6","v8.19.6","v9.0.9"],"title":"[Controls] Fix initialization race condition","number":237726,"url":"https://github.com/elastic/kibana/pull/237726","mergeCommit":{"message":"[Controls] Fix initialization race condition (#237726)\n\nFixes a race condition in the controls initialization step.","sha":"e26e842a094f95c0396bdd91f70ecd409956082d"}},"sourceBranch":"main","suggestedTargetBranches":["9.1","8.19","9.0"],"targetPullRequestStates":[{"branch":"9.2","label":"v9.2.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/239007","number":239007,"state":"OPEN"},{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/237726","number":237726,"mergeCommit":{"message":"[Controls] Fix initialization race condition (#237726)\n\nFixes a race condition in the controls initialization step.","sha":"e26e842a094f95c0396bdd91f70ecd409956082d"}},{"branch":"9.1","label":"v9.1.6","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.6","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.9","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->
# Backport This will backport the following commits from `main` to `8.19`: - [[Controls] Fix initialization race condition (#237726)](#237726) <!--- Backport version: 10.0.2 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Devon Thomson","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-10-14T19:46:49Z","message":"[Controls] Fix initialization race condition (#237726)\n\nFixes a race condition in the controls initialization step.","sha":"e26e842a094f95c0396bdd91f70ecd409956082d","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Presentation","loe:small","release_note:skip","impact:medium","backport:version","v9.2.0","v9.3.0","v9.1.6","v8.19.6","v9.0.9"],"title":"[Controls] Fix initialization race condition","number":237726,"url":"https://github.com/elastic/kibana/pull/237726","mergeCommit":{"message":"[Controls] Fix initialization race condition (#237726)\n\nFixes a race condition in the controls initialization step.","sha":"e26e842a094f95c0396bdd91f70ecd409956082d"}},"sourceBranch":"main","suggestedTargetBranches":["9.1","8.19","9.0"],"targetPullRequestStates":[{"branch":"9.2","label":"v9.2.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/239007","number":239007,"state":"OPEN"},{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/237726","number":237726,"mergeCommit":{"message":"[Controls] Fix initialization race condition (#237726)\n\nFixes a race condition in the controls initialization step.","sha":"e26e842a094f95c0396bdd91f70ecd409956082d"}},{"branch":"9.1","label":"v9.1.6","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.6","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.9","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->
Fixes a race condition in the controls initialization step.
Fixes a race condition in the controls initialization step.
Fixes a race condition in the controls initialization step.
Fixes a race condition in the controls initialization step.
Summary
Fixes a race condition in the controls initialization step. Followup to #237169.
This should make the fix for the double-refetch bug more robust as now the Dashboard panels will not load at all until the Controls have finished initializing, and the control group has finished combining their initial filters into its filters array.
There should be no user-facing changes in this PR as the previous fix worked correctly despite not fixing the underlying race condition as the panel initialization step always takes longer than the filter publish & data view fetch step.
Changes: