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)
Wed, Nov 27, 11:39 AM
Unknown Object (File)
Wed, Nov 13, 4:05 AM
Unknown Object (File)
Mon, Nov 11, 9:28 PM
Unknown Object (File)
Mon, Nov 11, 8:34 PM
Unknown Object (File)
Mon, Nov 11, 8:33 PM
Unknown Object (File)
Mon, Nov 11, 6:38 PM
Unknown Object (File)
Mon, Nov 11, 6:43 AM
Unknown Object (File)
Mon, Nov 4, 1:13 AM
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
Branch
ashoat/drawer
Lint
No Lint Coverage
Unit
No Test Coverage

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.