You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$500] Chat - Inconsistency in displaying unread green line when navigating from thread #31026
Version Number: 1.3.96-5 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: Applause - Internal Team Slack conversation:
Action Performed:
Navigate to staging.new.expensify.com
Go to chat with long history
Mark the latest message as unread
Scroll up and enter a thread
Tap on the subtitle in thread to return to main chat
Scroll down and note that green line is still there
Tap on the back button
Tap on the subtitle again
Scroll down and note that the green line is gone
Tap on the back button twice
Expected Result:
The green line for unread message will not show up since the unread message is visited and the green line is gone in Step 9
Actual Result:
The green line for unread message reappears
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
changed the title [-]Chat - Inconsistency in displaying unread green line when navigating from thread[/-][+][$500] Chat - Inconsistency in displaying unread green line when navigating from thread[/+]on Nov 7, 2023
Why can't we set currentUnreadMarker if that is not a null. I think this is wrong. currentUnreadMarker should be able to change when it's not a null
During the iteration, currentUnreadMarker can be changed and the iteration would be started again because the dependency changes. This forces re-render
We have redundant dependencies below. All other dependencies except shouldDisplayNewMarker are already shouldDisplayNewMarker's dependencies. No needs to add here
Please re-state the problem that we are trying to solve in this issue.
Inconsistency in displaying unread green line when navigating from thread
What is the root cause of that problem?
When a user reply in thread and navigate to the same report via the subtitle link (repeatedly) report screens with the same report will exist in the navigation stack so when the user navigates back they will navigate back to the report screen with the same report in it's previous state as we are not reseting currentUnreadMarker whenever the user opens a new report.
What changes do you think we should make in order to solve the problem?
In RepotActionList We need to have a useEffect that runs when the screen loses focus and the current report is not top most report we should reset currentUnreadMarker so we can do that by
We can also use Navigation.getTopmostReportId to get the topmost report but the above suffices as we use a global variable prevReportID to track the top most reportID
And additionally if we want we can call calculateUnreadMaker whenever the screen gets focus back and currentUnreadMarker is null so that it will recalculate unread marker if there is a new message received before navigating back 👍 and also call readNewestAction to mark it as unread same as we do if the user opened the report from LHN
@s-alves10 to proof that your solution doesn't work just on your suggested changes applied, mark as unread a report action and refresh the page now the marker is expected to be displayed as the logic of mark as unread is to have that marker when next time a user opens the report. But in your case the marker will display for a sec and it disappears when lastReadTime is changed. For your information messageManuallyMarkedUnread is used to decide not to display the marker for the user's own message or report action unless it is manually marked unread.
In my opinion, all other logic is working fine (expect the unnecessary dependencies you mentioned which we can remove) so I suggest we only fix this specific issue.
📣 @FitseTLT 🎉 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 📖
Given a chat report between user A and user B, and user A and user C, and user A has chat view with user B open
When user C sends message to user A, and user A switches to chat view with user C
Then user A should see the new marker line above the new messages, and the new marker line should persist until userA switches to another chat view.
Same chat open(no unread message):
Given a chat report between user A and user B, and user A has chat view with user B open and no unread message and no unread marker
When user B sends message to user A
Then user A should not see any new marker line
Same chat open(with unread message):
Given a chat report between user A and user B, and user A has chat view with user B open and user A has unread messages and new marker line
When user B sends message to user A
Then the new marker line should persist until userA switches to another chat view.
Same chat open(with user scrolled up):
Given a chat report between user A and user B, and user A has chat view with user B open and has no unread messages and no new marker line
When user A scrolls up to the old chats and user B sends message to user A
Then user A should see the green badge with “New Messages” and the new marker line above the new messages, and the new marker line should persist until userA switches to another chat view.
Redirecting to chat from email notification:
Given a chat report between user A and user B, and user A is not active on chat or offline
When user B sends message to user A and user A receives email notification and clicks on the link in the message
Then user A should be redirected to the chat view with user B and see the new marker line above the new messages, and the new marker line should persist until userA switches to another chat view.
Marking message as unread:
Given a chat report between user A and user B, and user A is active on a chat view with user B
When user A marks any report as unread i.e. click on “Mark as unread”
Then user A should see the new marker line above that message, and it won’t be removed until the user revisits the chat and switches to another chat then.
Deleting a message(other than unread message):
Given a chat report between user A and user B, and user A is active on a chat view with user B, and there is an unread message and unread marker
When user B sends a new message and deletes that message (other then the message above which there is an unread marker)
Then there should be no effect on the new marker line and user A should see the new marker line, and it won’t be removed until the user switches to another chat or the sender deletes all new messages.
Deleting an unread message:
Given a chat report between user A and user B, and user A is active on a chat view with user B, and there is an unread message and unread marker
When user B deletes a message above which there is an unread marker
Then user A should should not see the unread marker and the new message that was deleted
Marking as unread and deleting a message
Given a chat report between user A and user B
User A sends message to user B and marks the last sent message as unread
User A deletes the last sent message
Then the new marker line above last message should be removed
Now user A, sends three messages to user B - m1, m2, and m3 in order
User A marks m2 as unread
Then New marker line should be above m2
Now user A deletes m2
Then new marker line should be above next message i.e m3 in this case
@MonilBhavsar After #40315 now the subtitle link will goBack instead of navigate So this bug is not reproducible anymore as we can't have two report screen with the same report id simultaneously by using subtitle link.
Activity
[-]Chat - Inconsistency in displaying unread green line when navigating from thread[/-][+][$500] Chat - Inconsistency in displaying unread green line when navigating from thread[/+]melvin-bot commentedon Nov 7, 2023
Job added to Upwork: https://www.upwork.com/jobs/~01e2d8d823ccdf91aa
melvin-bot commentedon Nov 7, 2023
Triggered auto assignment to @JmillsExpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Nov 7, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)melvin-bot commentedon Nov 7, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Ollyws (
External)dummy-1111 commentedon Nov 8, 2023
This issue will be fixed by #30696 (comment)
@Ollyws
Will you take a look?
dummy-1111 commentedon Nov 8, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
There are some inconsistencies in displaying unread green line marker when navigating from and to thread
What is the root cause of that problem?
The main issue is in weird logic of the following code
App/src/pages/home/report/ReportActionsList.js
Lines 324 to 330 in 9cecdfa
currentUnreadMarkerif that is not a null. I think this is wrong.currentUnreadMarkershould be able to change when it's not a nullcurrentUnreadMarkercan be changed and the iteration would be started again because the dependency changes. This forces re-rendershouldDisplayNewMarkerare alreadyshouldDisplayNewMarker's dependencies. No needs to add hereApp/src/pages/home/report/ReportActionsList.js
Line 335 in 9cecdfa
What changes do you think we should make in order to solve the problem?
App/src/pages/home/report/ReportActionsList.js
Lines 300 to 335 in 9cecdfa
to
Remove the below code segments
App/src/pages/home/report/ReportActionsList.js
Line 149 in 4f92107
App/src/pages/home/report/ReportActionsList.js
Lines 193 to 206 in 4f92107
Update
App/src/pages/home/report/ReportActionsList.js
Line 348 in 4f92107
to
This works as expected
What alternative solutions did you explore? (Optional)
FitseTLT commentedon Nov 8, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Inconsistency in displaying unread green line when navigating from thread
What is the root cause of that problem?
When a user reply in thread and navigate to the same report via the subtitle link (repeatedly) report screens with the same report will exist in the navigation stack so when the user navigates back they will navigate back to the report screen with the same report in it's previous state as we are not reseting
currentUnreadMarkerwhenever the user opens a new report.What changes do you think we should make in order to solve the problem?
In RepotActionList We need to have a
useEffectthat runs when the screen loses focus and the current report is not top most report we should resetcurrentUnreadMarkerso we can do that byWe can also use
Navigation.getTopmostReportIdto get the topmost report but the above suffices as we use a global variableprevReportIDto track the top most reportIDAnd additionally if we want we can call
calculateUnreadMakerwhenever the screen gets focus back and currentUnreadMarker is null so that it will recalculate unread marker if there is a new message received before navigating back 👍 and also callreadNewestActionto mark it as unread same as we do if the user opened the report from LHNFitseTLT commentedon Nov 8, 2023
@s-alves10 to proof that your solution doesn't work just on your suggested changes applied, mark as unread a report action and refresh the page now the marker is expected to be displayed as the logic of mark as unread is to have that marker when next time a user opens the report. But in your case the marker will display for a sec and it disappears when
lastReadTimeis changed. For your informationmessageManuallyMarkedUnreadis used to decide not to display the marker for the user's own message or report action unless it is manually marked unread.App/src/pages/home/report/ReportActionsList.js
Lines 306 to 309 in b8f91a4
In my opinion, all other logic is working fine (expect the unnecessary dependencies you mentioned which we can remove) so I suggest we only fix this specific issue.
66 remaining items
melvin-bot commentedon Apr 12, 2024
📣 @Ollyws 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!
Offer link
Upwork job
melvin-bot commentedon Apr 12, 2024
📣 @FitseTLT 🎉 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 📖
FitseTLT commentedon Apr 12, 2024
@MonilBhavsar We don't have access to it 😢
MonilBhavsar commentedon Apr 12, 2024
Oops sorry, Pasting it here
Unread tests
m1, m2, and m3in orderm2as unreadm2m2m3in this caseFitseTLT commentedon Apr 12, 2024
Thx
MonilBhavsar commentedon Apr 23, 2024
@FitseTLT what's the ETA for the PR?
FitseTLT commentedon Apr 23, 2024
@MonilBhavsar After #40315 now the subtitle link will
goBackinstead ofnavigateSo this bug is not reproducible anymore as we can't have two report screen with the same report id simultaneously by using subtitle link.MonilBhavsar commentedon Apr 23, 2024
Okay, thanks for clarifying. Let's reopen if reproducible