-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
LHN order improvements #12978
LHN order improvements #12978
Conversation
src/libs/SidebarUtils.js
Outdated
draftReports = _.sortBy(draftReports, report => report.displayName.toLowerCase()); | ||
nonArchivedReports = _.sortBy(nonArchivedReports, report => (isInDefaultMode ? report.lastMessageTimestamp : report.displayName.toLowerCase())); | ||
nonArchivedReports = nonArchivedReports.sort((a, b) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i noticed that nonArchivedReports also showed up very differently between web and mobile. I made some improvements so that it sorts more consistently between mobile and web.
But its not perfect. There is a chance both messageTimestamp and displayNames are the same. For example i noticed for some #admin rooms the order would be off. We could further sort on policyID but i didn't want to go into a rabbit hole if it's not currently a problem and I'm content with the current improvement.
PR works. It took me some time to figure out testing to confirm its working better than before. |
@aimane-chnaif @srikarparsi One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Reviewer Checklist
Screenshots/Videos |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me and tests well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
running checklist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chiragsalian what if we use orderBy? That way it takes care of sorting with multiple keys, we can use lower case and can use ascending and descending. I think it could make the code a little simpler.
var outstandingIOUReport = [
{ iouReportAmount: 20, displayName: 'Barney'},
{ iouReportAmount: 20, displayName: 'adam'},
{ iouReportAmount: 30, displayName: 'travis'}
];
result = _.orderBy(users, ['iouReportAmount', 'displayName.toLowerCase()'], ['asc', 'desc']);
I didn't use orderBy at first since I thought conditions like |
cool yeah, also is there a reason you imported lodashOrderBy. underscore is already imported so I was thinking to just use _.orderBy(...) |
underscore does not have orderBy. Its only available in lodash. |
Updated, retested and ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me :)
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to production by @chiragsalian in version: 1.2.38-6 🚀
|
Details
The issue was that in the past we we're sorting to show the highest IOU bill at the top. But when there are multiple bills of the same amount there is no secondary sort. So the items can show up in different order on web and mobile based on how their onyx data is saved.
So i updated the code such while ordering with highest IOU bill at top, if two IOU amounts are the same then we use report.displayName as a fallback sort for consistency.
Fixed Issues
$ #11590
PROPOSAL: #livingOnTheEdge
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
filesWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)PR Reviewer Checklist
The reviewer will copy/paste it into a new comment and complete it after the author checklist is completed
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
).src/languages/*
filesWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
have been tested & I retested again)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Screenshots/Videos
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android