-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[$250] Chat - "New Messages" badge is displayed when navigating to the link of a message #52782
Comments
Triggered auto assignment to @greg-schroeder ( |
Job added to Upwork: https://www.upwork.com/jobs/~021859357029005874727 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @thesahindia ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.When a user follows a link to a specific message in a chat with long history, the "New messages" badge incorrectly appears temporarily while landing on the target message, even though it shouldn't be shown in this context since the user is intentionally viewing an older message. What is the root cause of that problem?The root cause appears to be in the ReportActionsList component where the floating message counter visibility logic doesn't properly handle the case of comment linking. The current implementation checks the scroll position against a threshold to determine whether to show the badge, but doesn't take into account that the user arrived via a direct message link. App/src/pages/home/report/ReportActionsList.tsx Lines 469 to 484 in 99da1ac
What changes do you think we should make in order to solve the problem?We should make the following specific changes to the
// Converts the ID to a boolean - true if we have a linked message ID, false if not
// This ref will track whether we're currently in the initial view of a linked message
const isInitialLinkedMessageView = useRef(!!linkedReportActionID);
const handleUnreadFloatingButton = () => {
// Don't show the floating button if we're viewing a linked message and haven't scrolled away yet
if (isInitialLinkedMessageView.current) {
return;
}
if (scrollingVerticalOffset.current > VERTICAL_OFFSET_THRESHOLD && !isFloatingMessageCounterVisible && !!unreadMarkerReportActionID) {
setIsFloatingMessageCounterVisible(true);
}
if (scrollingVerticalOffset.current < VERTICAL_OFFSET_THRESHOLD && isFloatingMessageCounterVisible) {
if (readActionSkipped.current) {
readActionSkipped.current = false;
Report.readNewestAction(report.reportID);
}
setIsFloatingMessageCounterVisible(false);
}
};
const trackVerticalScrolling = (event: NativeSyntheticEvent<NativeScrollEvent>) => {
scrollingVerticalOffset.current = event.nativeEvent.contentOffset.y;
// If we detect significant scroll movement, we're no longer in the initial linked message view
if (isInitialLinkedMessageView.current && Math.abs(event.nativeEvent.contentOffset.y) > VERTICAL_OFFSET_THRESHOLD) {
// User has scrolled away, so we're no longer in linked message view
isInitialLinkedMessageView.current = false;
}
handleUnreadFloatingButton();
onScroll?.(event);
};
useEffect(() => {
// Reset linked message state when report changes
isInitialLinkedMessageView.current = !!linkedReportActionID;
}, [report.reportID]); These changes will:
The solution uses a ref instead of state to avoid unnecessary re-renders and keeps track of the initial linked message context until the user actively scrolls away from it. This approach provides a smooth user experience while being efficient in terms of performance. What alternative solutions did you explore? (Optional)
|
ProposalPlease re-state the problem that we are trying to solve in this issue.new message floater showing when we link to a chat message What is the root cause of that problem?The problem is in these lines in App/src/pages/home/report/ReportActionsList.tsx Lines 722 to 729 in e04d145
When we link to a comment or a chat message in general, isFloatingMessageCounterVisible stays false since it's value depends on unreadMarkerReportActionID which is only set when we get a new message and it isn't in view threshold (has got nothing to do with message or comment linking). canScrollToNewerComments becomes true in case of message linking since it's being used to show New messages floater in case of comment linking. So when we linked to a specific message in a chat, canScrollToNewerComments becomes true and starts showing "New Message" floater.In the video the floater disappears after showing up for a split second. It's because canScrollToNewerComments has !hasNewestReportAction as one of the conditions for it to be true and if we look at hasNewestReportAction
it has got a condition to check whether last action's timestamp matches report's last visible action's timestamp and since data is being loaded in a paginated way, the condition get's set to false (which sets !hasNewestReportAction to true) since the last action for the chat isn't loaded yet and once it's loaded, condition gets set to true (which sets !hasNewestReportAction to false) and so floater shows up for a split second. What changes do you think we should make in order to solve the problem?Here I am assuming that we need to show const isThread = parentReportActionForTransactionThread ?? parentReportAction; here const canScrollToNewerComments = isThread && !isLoadingInitialReportActions && !hasNewestReportAction && sortedReportActions.length > 25 && !isLastPendingActionIsDelete; This'll stop setting What alternative solutions did you explore? (Optional)Alternate would be to not show Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job. |
@greg-schroeder, @thesahindia Huh... This is 4 days overdue. Who can take care of this? |
Proposal review underway cc @thesahindia |
@hunghinh2000, what will happen if I am in the linked message view and receive a new message? Will I get the 'New messages' badge? |
We don't want it to appear when navigating to the linked message.
@me-ZaidAli, could you please elaborate that? Are you implying that we don't need |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@thesahindia the App/src/pages/home/report/ReportActionsList.tsx Lines 722 to 724 in e04d145
|
@greg-schroeder, could we please confirm the expected result here? It seems like the design was to show the "New messages" badge after the redirection. Found these steps from the PR that implemented this feature:
|
@greg-schroeder @thesahindia this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks! |
@greg-schroeder, @thesahindia Eep! 4 days overdue now. Issues have feelings too... |
Asking the team @thesahindia |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@greg-schroeder, @thesahindia 6 days overdue. This is scarier than being forced to listen to Vogon poetry! |
Team agrees expected behavior per #52782 (comment) |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.0.64-0
Reproducible in staging?: Y
Reproducible in production?: Y
Issue reported by: Applause Internal Team
Action Performed:
Expected Result:
When navigating to a message´s link, the user should land on the correct chat, the message should be highlighted and the "New Messages" badge should not be displayed.
Actual Result:
When the user navigates to the link of a message on a chat with long history, the "New Messages" badge can be seen for some time when landing on the message.
Workaround:
Unknown
Platforms:
Screenshots/Videos
Bug6669706_1732032298305.Badge.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @thesahindiaThe text was updated successfully, but these errors were encountered: