App
App copied to clipboard
[$750] Chat - When opening a chat with lots of unread messages user needs to scroll up to find last read message
If you havenβt already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 1.4.28.0 Reproducible in staging?: y Reproducible in production?: y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: @MonilBhavsar Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1705558628672569
Action Performed:
- A is participant of a chat or room
- As another user send some good number of messages to chat report, so new messages can be scrolled up and down
- As user A, open the chat report
Expected Result:
The chat report view opens from where the messages are unread and user can scroll down
Actual Result:
The chat report view is scrolled down to the last message and user needs to scroll up to find last read message
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
- [x] Android: Native
- [x] Android: mWeb Chrome
- [x] iOS: Native
- [x] iOS: mWeb Safari
- [x] MacOS: Chrome / Safari
- [x] MacOS: Desktop
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/Expensify/App/assets/93399543/55def247-9ffe-439d-8f24-12aa35aee272
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~01fc144b2f2f5df388
- Upwork Job ID: 1749920553887232000
- Last Price Increase: 2024-04-27
Triggered auto assignment to @trjExpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Job added to Upwork: https://www.upwork.com/jobs/~01fc144b2f2f5df388
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mollfpr (External)
This PR https://github.com/Expensify/App/pull/28793 specifically makes it scrolled to the bottom, seems like NAB
I'm a bit confused by the bug report @MonilBhavsar, so asking about it here. I thought this was something we'd implement via comment linking.
HOLD for comment linking: https://github.com/Expensify/App/pull/30269
Current assignee @trjExpensify is eligible for the NewFeature assigner, not assigning anyone new.
No change, still on hold Melv!
Samesies, Melv!
Still on hold, comment linking got held for the deploy freeze last week.
PR still not merged.
Comment linking PR still in the works.
@roryabraham, you okay with now taking this off hold?
Bumped!
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
Looking for proposals. @jeremy-croff not sure if you're interested?
@trjExpensify, @mollfpr Whoops! This issue is 2 days overdue. Let's get this updated quick!
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
Still looking for proposals!
@trjExpensify, @mollfpr Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
Upwork job price has been updated to $750
Bumped the price up to $750
Proposal
Please re-state the problem that we are trying to solve in this issue
When opening a chat with lots of unread messages, the user needs to scroll up to find last read message.
What is the root cause of that problem?
New Feature - The logic is missing / non-existent.
What changes do you think we should make in order to solve the problem?
We need a new useEffect within the ReportActionsList component which will scrollToFirstUnreadMessage when we open the report.
To do this we will need to modify our existing reportScrollManager.scrollToIndex function to optionally take in the viewPosition argument because we're inverting the flatlist which means that we would need to pass viewPosition: 1 to the FlatList's scrollToIndex function such that we are scrolling to the top of the new message (unread marker).
New useEffect code
useEffect(() => {
// Logic to scroll to the first unread message, if there is one and it's not in view.
const scrollToFirstUnreadMessage = () => {
if (!currentUnreadMarker) {
return;
}
const unreadMessageIndex = sortedVisibleReportActions.findIndex((action) => action.reportActionID === currentUnreadMarker);
if (unreadMessageIndex !== -1) {
// We're passing viewPosition: 1 since we're using an InvertedFlatList.
reportScrollManager?.scrollToIndex(unreadMessageIndex, false, 1);
}
};
// Call the scroll function after a small delay to ensure all items
// have been measured and the list is ready to be scrolled.
InteractionManager.runAfterInteractions(scrollToFirstUnreadMessage);
// We only want to run this effect once, when we're navigating to a report with unread messages.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [sortedVisibleReportActions]);
Besides the above new useEffect code introduced as part of this new feature, here's a test branch test/35011 and the diff in order to review all the changes introduced as part of this feature, including the scrollToIndex related changes for both web / native platforms.
Additionally: (did not add this to the current solution) we could also introduce the viewOffset argument to the scrollToIndex function if we want some additional offset such that the new unread message marker would have better visibility if in the below picture example it's not visible enough (current solution, also see videos):
Video results
MacOS: Chrome / Safari
https://github.com/Expensify/App/assets/56457735/c37e15f1-17c4-4bc7-b357-c94e01cbcc2e
iOS: Native
https://github.com/Expensify/App/assets/56457735/e4282338-310e-44d3-97b2-447ebf7d2fb6
Android: mWeb
https://github.com/Expensify/App/assets/56457735/9a00be14-b09d-40d9-bae3-4171605fe83a
@trjExpensify, @mollfpr Whoops! This issue is 2 days overdue. Let's get this updated quick!
@mollfpr can you review this proposal please? CC: @roryabraham feels like one you'd be interested in as well. :)
Sorry for the delay π
The @ikevin127 proposal looks good to me!
π π π C+ reviewed!
Triggered auto assignment to @yuwenmemon, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
π£ @ikevin127 π An offer has been automatically sent to your Upwork account for the Contributor role π Thanks for contributing to the Expensify app!
Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review π§βπ» Keep in mind: Code of Conduct | Contributing π
PR https://github.com/Expensify/App/pull/41448 ready for review! π
β οΈ Looks like this issue was linked to a Deploy Blocker here
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.
If a regression has occurred and you are the assigned CM follow the instructions here.
If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.