-
Notifications
You must be signed in to change notification settings - Fork 396
Fix FileTypeChoices in Storage Pickers to preserve insertion order #5948
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
Merged
+427
−27
Conversation
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
Scottj1s
reviewed
Oct 29, 2025
Scottj1s
reviewed
Oct 29, 2025
Scottj1s
reviewed
Oct 29, 2025
Scottj1s
reviewed
Oct 29, 2025
Scottj1s
reviewed
Oct 29, 2025
Scottj1s
reviewed
Oct 29, 2025
Scottj1s
reviewed
Oct 29, 2025
Scottj1s
reviewed
Oct 29, 2025
codendone
reviewed
Oct 29, 2025
DrusTheAxe
reviewed
Oct 30, 2025
DrusTheAxe
reviewed
Oct 30, 2025
DrusTheAxe
reviewed
Oct 30, 2025
DrusTheAxe
reviewed
Oct 30, 2025
Scottj1s
reviewed
Nov 12, 2025
Scottj1s
reviewed
Nov 12, 2025
Scottj1s
reviewed
Nov 12, 2025
Scottj1s
reviewed
Nov 12, 2025
Scottj1s
reviewed
Nov 12, 2025
Scottj1s
approved these changes
Nov 13, 2025
Contributor
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
codendone
approved these changes
Nov 13, 2025
Contributor
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
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.
Description
This is a fix for issue:
The existing FileTypeChoices property was built on an unordered map, which does not preserve the user-defined order.
However, in the FileOpenPicker and FileSavePicker, the FileTypeChoices need to be displayed in the order they were inserted, rather than in a random order.
This is important for developers' and end-users' experience because:
Additionaly, the insertion order is respected in the legacy UWP FileSavePicker.
Fix
This is a backward-compatible fix. The goal of this fix is to maintain the existing Map type API contract and its good performance while ensuring that the display order of FileTypeChoices meets expectations.
This pull request refactors the implementation of the
FileTypeChoicesMapto ensure that the insertion order of keys is preserved and provides efficient key lookups. It replaces the previous unordered map-based implementation with the implementation backed by a vector. The update also introduces custom iterator and view classes to support this ordered behavior and modifies related tests to verify the new insertion order.Code change details:
Ordered map implementation and API changes:
FileTypeChoicesMapfrom an unordered map to astd::vectorof key-value pairs (FileTypeChoiceVector), managed by ashared_ptrto preserve insertion order and support multiple views/iterators. [1] [2]OrderedMapIterator) and view (OrderedMapView) classes to enable ordered iteration and lookup, updating all methods (Insert,Lookup,Remove,Clear,First, etc.) to operate on the new ordered vector structure. [1] [2]API surface and helper improvements:
noexceptwhere appropriate and refactored helper methods for key lookup usingstd::ranges::find. [1] [2]Test updates for ordered behavior: