[HOLD for payment 2022-01-21] In #focus mode, active chats should show beneath pinned chats in the LHN
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Action Performed:
- Set your LHN to #focus mode
- Pin 2+ chats
- Set your active chat to be a non-pinned chat, that alphabetically would not be the last chat in your LHN
- Observe the chat being placed within the pinned chats, instead of after them
Expected Result:
Pinned conversations should always be displayed on top of the LHN list. any other active chats should show beneath pinned chats in the LHN.
Actual Result:
Conversations are displayed on alphabetical order and non pinned chats are mixed with regular chats.
Workaround:
None needed, visual issue.
Platform:
Where is this issue occurring?
- Web
- iOS
- Android
- Desktop App
- Mobile Web
Version Number: 1.1.17-0
Reproducible in staging?: Yes Reproducible in production?: Yes
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

Upwork job: https://www.upwork.com/jobs/~01ff25496a7aa2449e
Issue reported by: @alex-mechler Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1638299485080700
Triggered auto assignment to @robertjchen (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.
Thanks for the report! Looks like a great task for our contributors
Triggered auto assignment to @michaelhaxhiu (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.
Update:
- Just tested and this is legit 🐛
- Updated the title in favor of clarity 🧼
- Posted to upwork 💰 https://www.upwork.com/jobs/~01ff25496a7aa2449e
Triggered auto assignment to @parasharrajat (Exported)
Triggered auto assignment to @Luke9389 (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.
Hmm, I think we're double assigning CME's now. The Exported label does it, and so does the Help Wanted label.
Proposal
In our opinion, we should check if focusMode is enabled and sort result Array with isPinned value in SidebarLinks.js.
We have to add focusMode prop from onyx here:
withOnyx({
focusMode : {
key : ONYXKEYS.NVP_PRIORITY_MODE
},
in propTypes :
/** The user's focusMode */
focusMode: PropTypes.string,
and do something like this in getRecentReports(props) function :
static getRecentReports(props) {
const activeReportID = parseInt(props.currentlyViewedReportID, 10);
const sidebarOptions = OptionsListUtils.getSidebarOptions(
props.reports,
props.personalDetails,
activeReportID,
props.priorityMode,
props.betas,
);
if (props.focusMode !== 'gsd') {
return sidebarOptions.recentReports;
} else {
return sidebarOptions.recentReports.sort( (element, nextElement) => nextElement.isPinned - element.isPinned);
}
}
Before Changes
https://user-images.githubusercontent.com/71173662/145391285-c2179259-aac5-473b-bb49-26f86af19983.mp4
After Changes
https://user-images.githubusercontent.com/71173662/145391379-ef6dff2e-748c-4fc6-8ccd-1231f951e42b.mp4
If you think that something is wrong, feel free to say us, we are open to discussion🙂.
@developvsn Thanks for the proposal but I think it can be improved a lot and require more analysis of the code.
- It does not fix the real cause.
- Add sugar coating.
- Will cause side-effects. You are missing the behavior of the SideLinks.js component.
- Does not tell how will you do it. It's just bits and pieces.
e.g.
We have to add focusMode prop from onyx here and do something like this in getRecentReports(props) function :
Where will you do this?
@parasharrajat
- Why do you think so? Data is coming in SideLink.js in correct way, we should only sort it and display.
- If you are talking about ternary operators, we changed it, thank you.
- We tried to check all situations, what we were possible to simulate.What do you mean?
- Changed.
I'm testing something unrelated to this issue, and need to remove/re-add the Exported label real quick. Ignore me.
Current assignee @parasharrajat is eligible for the Exported assigner, not assigning anyone new.
Current assignee @Luke9389 is eligible for the Exported assigner, not assigning anyone new.
Why do you think so? Data is coming in SideLink.js in correct way,
Data is coming in SideLink.js in correct way Then why are you sorting again. Sorting logic is already there.
Why do you think so? Data is coming in SideLink.js in correct way,
Data is coming in SideLink.js in correct way Then why are you sorting again. Sorting logic is already there.
Look like it sort by unread messages and the existing sort works correctly only for non-focus mode, so can you please give us an example, when our code will work wrong. Thank you
Proposal.
We forgot to add prioritizePinnedReports: true inside sideBarOptions in this code:
https://github.com/Expensify/App/blob/d827b9b9abdee6dd8cedb520ce51f38e39dccf3e/src/libs/OptionsListUtils.js#L689-L694
Adding prioritizePinnedReports: true resolve the problem for me.
Basically onyx CONST.PRIORITY_MODE save priority mode option value.
When we display LHN SidebarLinks, eventually getSidebarOptions will be called to get options on how we display OptionsList.
CONST.PRIORITY_MODE.GSD is option for focus mode and we need prioritizePinnedReports: true to make pinned tabs always on top.
https://github.com/Expensify/App/blob/d827b9b9abdee6dd8cedb520ce51f38e39dccf3e/src/libs/OptionsListUtils.js#L677
@parasharrajat? I am sorry, Is it not working? or not elaborate enough? I have edited the proposal.
@K4tsuki It does not work.
It doesn't work at all? It does works for me though.
For case sensitive sorting issue: https://github.com/Expensify/App/blob/d827b9b9abdee6dd8cedb520ce51f38e39dccf3e/src/libs/OptionsListUtils.js#L502
lodashOrderBy is case sensitive, so to sort it case insensitively we callback const sortedPinnedReports = lodashOrderBy( pinnedReportOptions, [ report => report.text.toLowerCase()], ['asc']);
Also on this:
https://github.com/Expensify/App/blob/d827b9b9abdee6dd8cedb520ce51f38e39dccf3e/src/libs/OptionsListUtils.js#L381