[Controls Anywhere] Fix reordering controls on delete#241045
Merged
Zacqary merged 2 commits intoelastic:controlsAnywherefrom Oct 30, 2025
Merged
[Controls Anywhere] Fix reordering controls on delete#241045Zacqary merged 2 commits intoelastic:controlsAnywherefrom
Zacqary merged 2 commits intoelastic:controlsAnywherefrom
Conversation
Contributor
|
Pinging @elastic/kibana-presentation (Team:Presentation) |
Heenawter
reviewed
Oct 28, 2025
src/platform/plugins/shared/dashboard/public/dashboard_api/layout_manager/layout_manager.ts
Outdated
Show resolved
Hide resolved
…out_manager/layout_manager.ts Co-authored-by: Hannah Mudge <Heenawter@users.noreply.github.com>
Contributor
💔 Build Failed
Failed CI StepsHistory
|
Heenawter
approved these changes
Oct 29, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prevents a Kibana-crashing runtime error that can occur when deleting multiple controls.
From
control_display_settings_popover.tsx:This can lead to a situation where
layoutEntry.order - 1might return undefined, and then throw a Kibana-crashing type error whenundefined.growdidn't exist.This is because when you delete controls, the remaining controls' order property doesn't get updated. So we could get into a situation where there are 3 controls, one of them has an order of 2, and if we delete controls 0 and 1, the sole existing control still has order: 2. It then tries to look up control at index 1, gets undefined, and errors out.
This PR recomputes control order when a control is deleted, preventing this error and any future situations that might arise from trying to look up controls based on their
order