[video] fix selected item after removing version/extra #24791
Merged
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.
Description
The selected item member was not updated after removing a version or extra
This PR selects the first item of the list when the previously selected item doesn't exist in the list anymore after Refresh() - for example after removal of an item.
The first checks are overkill for the current needs in the context of the Remove button but make the function bulletproof for the future.
Motivation and context
Fix #24485, which affects both versions and extras.
After removal of a version or extra, the top item of the list is highlighted and appears selected, but going to the remove button again attempts to remove again the already removed item, instead of removing the new selection.
How has this been tested?
Versions/Extras Manager still opens with correct default item selected (default version or 1st extra of the list)
Back to back removals work as expected on the new selected item (top of the list).
What is the effect on users?
Remove version/extra works as expected without side effects.
Types of change
Checklist: