Sort items and locations alphabetically in the client #110
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.
Related feature requests (might be more than this):
https://discord.com/channels/1097532591650910289/1219628970136571974
https://discord.com/channels/1097532591650910289/1166152300771950593
Having the items and locations be sorted is a long-requested feature, since their current orders are kinda arbitrary. So this PR sorts them both alphabetically. If we decide we want to sort them a different way later (or provide options to sort various ways), this at least sets the groundwork for any sort.
Sorting locations was the simple part of this. Basically a one-liner in a for loop.
Sorting items was the harder part of this. In the current client, we leave the existing item labels and only draw the new ones. To sort items easily, we have to instead redraw all of the item labels in their sorted name order. Unfortunately, this ran into an issue because our update function is called about 4-8 times per location send / item receive -- by us, UT, hints, etc. So the bold logic would work on the first update, then get overwritten by the subsequent ones.
So, this PR also includes functionality that buffers any update requests, then processes them all as a single request after a brief period of 1/4 of a second. Accidental but necessary performance boost 😃