Add container sorting to bookmark, new tab, reopen, settings menus #1136
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.
See #354 for impetus.
Context
When opening a new tab, reopening a tab in a container, opening a bookmark in a container, or viewing available containers in Sidebery settings, they currently are displayed in the order of creation rather than alphabetically.
This changeset introduces a sorting function (
sortContainers
) into the Container Actions file for reusability, and uses that sorting function for those aforementioned context menus and settings menus. I chose to uselocalCompare
to allow for cross language sorting based on browser settings.Please note that I haven't worked in TypeScript in a long while and wasn't very familiar with it to begin with, so if there are better ways of doing these things, please let me know :)
Testing
I followed the steps in the Contributing Guide and tested locally, making sure containers were sorted in the new tab, reopen in, open bookmark in, and settings menus.
Before, reopen in menu:
After, reopen in menu: