Page MenuHomePhabricator

[lib] Sort drawer items alphabetically
ClosedPublic

Authored by ashoat on Jul 8 2024, 8:59 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Oct 22, 8:42 AM
Unknown Object (File)
Fri, Oct 11, 3:31 AM
Unknown Object (File)
Fri, Oct 11, 3:31 AM
Unknown Object (File)
Fri, Oct 11, 3:31 AM
Unknown Object (File)
Fri, Oct 11, 3:31 AM
Unknown Object (File)
Fri, Oct 11, 3:31 AM
Unknown Object (File)
Sep 8 2024, 3:03 PM
Unknown Object (File)
Sep 8 2024, 3:03 PM
Subscribers
None

Details

Summary

This diff sorts communities and channels alphabetically by ENS-resolved names. It addresses ENG-8793, which has some more context.

Depends on D12700

Test Plan

I tested the stack as follows:

  1. I tested both native and web
  2. I tested both normal communities and GENESIS
  3. I tested both uppercase and lowercase names
  4. I made sure the list of channels was the same before and after (only the order changed)
  5. I edited a name on web and made sure its appearance in the order changed

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ashoat requested review of this revision.Jul 8 2024, 9:16 PM
lib/utils/drawer-utils.react.js
14–23 ↗(On Diff #42140)

Type changes were necessary to make sure itemChildren is mutable on WritableCommunityDrawerItemData (so it can be sorted in place)

tomek added inline comments.
lib/utils/drawer-utils.react.js
29–31 ↗(On Diff #42140)

Is this comparison a good idea for sorting? Can we use the same approach we're using in the rest of the codebase?

This revision is now accepted and ready to land.Jul 9 2024, 5:20 AM
lib/utils/drawer-utils.react.js
29–31 ↗(On Diff #42140)

Thanks! I got this solution from StackOverflow, didn't realize we already had a better approach in the codebase 😅

lib/utils/drawer-utils.react.js
29–31 ↗(On Diff #42140)

By using localeCompare, I was able to remove the toLowerCase call here as well!

This revision was landed with ongoing or failed builds.Jul 9 2024, 11:20 AM
This revision was automatically updated to reflect the committed changes.