Skip to content
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] Messages are not showing in the LHN when someone sends it #45356

Closed
1 of 6 tasks
m-natarajan opened this issue Jul 12, 2024 · 23 comments
Closed
1 of 6 tasks

[$250] Messages are not showing in the LHN when someone sends it #45356

m-natarajan opened this issue Jul 12, 2024 · 23 comments
Assignees
Labels
AutoAssignerNewDotQuality Used to assign quality issues to engineers Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@m-natarajan
Copy link

m-natarajan commented Jul 12, 2024

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:
Reproducible in staging?: needs reproduction
Reproducible in production?: needs reprroduction
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: @cead22
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1720045541007929

Action Performed:

  1. Have NewDot open as user A
  2. Send a message from user B to user A

Expected Result:

UserB's message should update in the LHN

Actual Result:

Message does not appear in the LHN and user A has to switch to another chat and open the chat report from B to appear the message

Workaround:

unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

SS before chat :

When opening chat with B image (20)

After opening the chat image (21)

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01263f65273fb956e2
  • Upwork Job ID: 1812617761124974581
  • Last Price Increase: 2024-07-14
  • Automatic offers:
    • dukenv0307 | Reviewer | 103235910
Issue OwnerCurrent Issue Owner: @lakchote
@m-natarajan m-natarajan added Daily KSv2 Needs Reproduction Reproducible steps needed Bug Something is broken. Auto assigns a BugZero manager. labels Jul 12, 2024
@MelvinBot
Copy link

This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989

Copy link

melvin-bot bot commented Jul 12, 2024

Triggered auto assignment to @jliexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@kabeer95
Copy link

Problem Statement: Messages are not displaying in the LHN (Left Hand Navigation) when someone sends a message, resulting in users missing important notifications and updates.

Root Cause: The root cause of the problem is likely due to an issue with the message rendering logic, WebSocket connection, or data storage.

Changes to Solve the Problem: To solve the problem, I propose the following changes:

  1. Update Message Rendering Logic Update the message rendering logic to ensure that new messages are correctly displayed in the LHN. This includes reviewing the message filtering and sorting logic to ensure that all messages are being displayed correctly.

// Update message rendering logic
const MessageList = () => {
const messages = useSelector((state) => state.messages);
const dispatch = useDispatch();

useEffect(() => {
dispatch(fetchMessages()); // Fetch messages on component mount
}, [dispatch]);

return (


{messages.map((message) => (

))}

);
};
2. Verify WebSocket Connection Verify that the WebSocket connection is established correctly and messages are being received from the server. This includes reviewing the WebSocket connection logic and error handling to ensure that messages are not being lost or dropped.

// Verify WebSocket connection
const socket = new WebSocket('wss://example.com/ws');

socket.onmessage = (event) => {
console.log(Received message: ${event.data});
// Handle incoming message and update LHN
};

socket.onopen = () => {
console.log('WebSocket connection established');
};

socket.onerror = (event) => {
console.error('WebSocket error:', event);
};
3. Check Data Storage Check that messages are being stored correctly in the database and retrieved correctly by the application. This includes reviewing the database schema and query logic to ensure that messages are being stored and retrieved correctly.

-- Check message storage in database
SELECT * FROM messages WHERE recipient_id = [user_id];
Alternative Solutions Explored:

Use a Different Message Rendering Library: Explore alternative message rendering libraries, such as react-chat-elements, to see if they provide better performance and reliability.
Implement Message Queueing: Implement message queueing to ensure that messages are processed and displayed in the correct order, even in cases of high traffic or network latency.
Add Error Handling: Add error handling to the message rendering logic to catch and display any errors that may occur, providing a better user experience.

@jliexpensify
Copy link
Contributor

jliexpensify commented Jul 14, 2024

I can reproduce this with only one person in my LHN - @SofiedeVreese. All of her messages don't appear unless I click out of her chat and back in.

I think this will be hard to accurately repro, but it can be reproduced.

@jliexpensify jliexpensify added External Added to denote the issue can be worked on by a contributor and removed Needs Reproduction Reproducible steps needed labels Jul 14, 2024
@melvin-bot melvin-bot bot changed the title Messages are not showing in the LHN when someone sends it [$250] Messages are not showing in the LHN when someone sends it Jul 14, 2024
Copy link

melvin-bot bot commented Jul 14, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01263f65273fb956e2

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 14, 2024
Copy link

melvin-bot bot commented Jul 14, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @dukenv0307 (External)

@MonilBhavsar
Copy link
Contributor

I think this should be criticial in newDot quality since it affects core chat workflow cc @muttmuure

@jliexpensify
Copy link
Contributor

Should we make this Internal or keep as External?

@puneetlath puneetlath added the AutoAssignerNewDotQuality Used to assign quality issues to engineers label Jul 18, 2024
@melvin-bot melvin-bot bot added the Overdue label Jul 18, 2024
Copy link

melvin-bot bot commented Jul 18, 2024

Triggered auto assignment to @lakchote (AutoAssignerNewDotQuality)

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Overdue labels Jul 18, 2024
@cead22
Copy link
Contributor

cead22 commented Jul 18, 2024

I got some messages from @iwiznia today, and the LHN isn't showing the chat as unread. I looked at onyx and it doesn't look like the report actions are in there, which explains why the message isn't being marked as unread. I think the issue we're seeing in this case is that the messages aren't being delivered to the client

This from gmail
image

And these are the last 3 report actions in onyx for that reportID

[
  {
    "html": "I used our social channel, but maybe I can use a better one, like a public channel",
    "text": "I used our social channel, but maybe I can use a better one, like a public channel",
    "type": "COMMENT",
    "whisperedTo": []
  }
]
[
  {
    "html": "Do you know one with many many participants?",
    "text": "Do you know one with many many participants?",
    "type": "COMMENT",
    "whisperedTo": []
  }
]
[
  {
    "html": "Yeah I think it runs a lot which is why I think 10-12ms <em>could</em> be a problem",
    "text": "Yeah I think it runs a lot which is why I think 10-12ms could be a problem",
    "type": "COMMENT",
    "whisperedTo": []
  }
]

After opening the chat, I get all the messages

[
  {
    "type": "COMMENT",
    "html": "Yeah I think it runs a lot which is why I think 10-12ms <em>could</em> be a problem",
    "text": "Yeah I think it runs a lot which is why I think 10-12ms could be a problem",
    "isEdited": false,
    "whisperedTo": [],
    "isDeletedParentAction": false,
    "deleted": "",
    "reactions": []
  }
]
[
  {
    "type": "COMMENT",
    "html": "And more importantly it runs on many writes.",
    "text": "And more importantly it runs on many writes.",
    "isEdited": false,
    "whisperedTo": [],
    "isDeletedParentAction": false,
    "deleted": "",
    "reactions": []
  }
]
[
  {
    "type": "COMMENT",
    "html": "So 5x on 2ms to 10ms is probably fine, but if there's indeed some that take 50ms and those are also  x 10 that would be 500ms which might be bad",
    "text": "So 5x on 2ms to 10ms is probably fine, but if there's indeed some that take 50ms and those are also  x 10 that would be 500ms which might be bad",
    "isEdited": true,
    "whisperedTo": [],
    "isDeletedParentAction": false,
    "deleted": "",
    "reactions": []
  }
]
[
  {
    "type": "COMMENT",
    "html": "<blockquote>Do you know one with many many participants?</blockquote>No, but yes, probably some of the public channels",
    "text": "Do you know one with many many participants?\nNo, but yes, probably some of the public channels",
    "isEdited": false,
    "whisperedTo": [],
    "isDeletedParentAction": false,
    "deleted": "",
    "reactions": []
  }
]
[
  {
    "type": "COMMENT",
    "html": "Once you find it, you should add it to the PR template: <a href=\"https://github.com/Expensify/Auth/blob/main/.github/PULL_REQUEST_TEMPLATE.md?plain=1#L21\" target=\"_blank\" rel=\"noreferrer noopener\">https://github.com/Expensify/Auth/blob/main/.github/PULL_REQUEST_TEMPLATE.md?plain=1#L21</a>",
    "text": "Once you find it, you should add it to the PR template: https://github.com/Expensify/Auth/blob/main/.github/PULL_REQUEST_TEMPLATE.md?plain=1#L21",
    "isEdited": false,
    "whisperedTo": [],
    "isDeletedParentAction": false,
    "deleted": "",
    "reactions": []
  }
]
[
  {
    "type": "COMMENT",
    "html": "Maybe one of those will do? I assumed big chats mean lots of messages though, not lots of people.",
    "text": "Maybe one of those will do? I assumed big chats mean lots of messages though, not lots of people.",
    "isEdited": false,
    "whisperedTo": [],
    "isDeletedParentAction": false,
    "deleted": "",
    "reactions": []
  }
]
[
  {
    "type": "COMMENT",
    "html": "Yep, just checked, those are chats with only 2 people",
    "text": "Yep, just checked, those are chats with only 2 people",
    "isEdited": false,
    "whisperedTo": [],
    "isDeletedParentAction": false,
    "deleted": "",
    "reactions": []
  }
]

@iwiznia
Copy link
Contributor

iwiznia commented Jul 18, 2024

Investigated this with @cead22. Here are logs from his device. One of the messages I sent and he was not seeing has actionID of 5285273928576337160

Conclusions are:

  • Update is getting received by the client. You can see this in this line: [App] 2024-07-18T16:22:28.159Z - [info] [Report] Handled multipleEvents event sent by Pusher ~~ updates: '[0: '[data: '[0: '[key: 'report_64983050' onyxMethod: 'merge' value: '[chatType: '' lastActorAccountID: '2536717' lastMessageText: '<REDACTED>' lastVisibleActionCreated: '2024-07-18 16:22:19.266' managerID: '' parentReportActionID: '' parentReportID: '' participants: '[2536717: '[hidden: '']']' policyID: '_FAKE_' reportID: '64983050' reportName: 'Chat Report' stateNum: '0' statusNum: '0' type: 'chat' visibility: '']']' 1: '[key: 'reportActions_64983050' onyxMethod: 'merge' shouldShowPushNotification: '1' value: '[5285273928576337160: '[actionName: 'ADDCOMMENT' actorAccountID: '2536717' avatar: 'https://d1wpcgnaa73g0y.cloudfront.net/eb8f557c896f180c5e464001102be4c417f436e2_128.jpeg' created: '2024-07-18 16:22:19.266' lastModified: '2024-07-18 16:22:19.266' message: '[0: '[html: '<REDACTED>' text: '<REDACTED>' type: 'COMMENT' whisperedTo: '[]']']' originalMessage: '[html: '<REDACTED>' lastModified: '2024-07-18 16:22:19.266']' person: '[0: '[style: 'strong' text: '<REDACTED>' type: 'TEXT']']' previousReportActionID: '3689954795802921812' reportActionID: '5285273928576337160' shouldShow: '1']']']' 2: '[key: 'personalDetailsList' onyxMethod: 'merge' value: '[2536717: '[accountID: '2536717' avatar: 'https://d1wpcgnaa73g0y.cloudfront.net/eb8f557c896f180c5e464001102be4c417f436e2_128.jpeg' displayName: 'Ionatan Wiznia' firstName: 'Ionatan' lastName: 'Wiznia' login: 'ionatan@expensify.com' phoneNumber: '' pronouns: '__predefined_callMeByMyName' status: '' timezone: '[automatic: '1' selected: 'Europe/Madrid']' validated: '1']']']']' eventType: 'onyxApiUpdate']']' lastUpdateID: '634937822' previousUpdateID: '634749228' userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36'. You can see the ADDCOMMENT action with the ID mentioned above
  • The update is NOT being applied to onyx, since we should see a line like [info] [Onyx] merge called for key: reportActions_64983050 properties with the actionID in it, but we don't see that till here at 2024-07-18T16:55:23.491Z (local time)

My guess is that the bug is that client needs to be updated here but something in OnyxUpdates.saveUpdateInformation is going wrong and the update is never applied.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 Weekly KSv2 labels Jul 18, 2024
@iwiznia
Copy link
Contributor

iwiznia commented Jul 18, 2024

The PR I sent will log whenever we detect the onyx updates need updating.

@mallenexpensify
Copy link
Contributor

Shit.. we have two issues for this! I was able to reproduce this week and shared onyx data with Puneet. Check this thread

Since you sent a PR Ioni, I should close the other one, right? it's here

@mallenexpensify
Copy link
Contributor

mallenexpensify commented Jul 19, 2024

I just has an instance where LHN and the chats in #social didn't update. I had a sneaking suspicion they weren't so I captured onyx data, refreshed, then saw new chats load. Hope it's helpful (or you're able to find the logs and those are helpful)
social not loading updating.txt

@mallenexpensify
Copy link
Contributor

mallenexpensify commented Jul 22, 2024

#social still isn't auto-updating for me to show the latest chats in LHN. ie. Vit's showed as being the most recent in LHN but I felt like it had been sent quite a while ago, when I clicked on the channel, it updated to show multiple chats since the one Vit sent.

image

Onyx data before clicking on the room.
social not updating onyx.txt

Onyx data after clicking on the chat and opening the room.
Social onyx data AFTER chat updated.txt

Let me know if there's anything I can do to help get this fixed.

@puneetlath puneetlath assigned puneetlath and unassigned lakchote Jul 23, 2024
@puneetlath
Copy link
Contributor

@Kureev
Copy link
Contributor

Kureev commented Jul 23, 2024

Hi, I am Alexey from Margelo and I can work on this issue.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 23, 2024
Copy link

melvin-bot bot commented Jul 23, 2024

📣 @dukenv0307 🎉 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

@puneetlath puneetlath removed the Reviewing Has a PR in review label Jul 23, 2024
@mallenexpensify
Copy link
Contributor

lonnnnng thread in #newdot-quality here
We encountered the bug this week but the last ~24 hours we haven't been able to reproduce, so we're pausing.
#expensify-open-source post asking if others are experiencing.

Copy link

melvin-bot bot commented Jul 26, 2024

@puneetlath @Kureev @jliexpensify @dukenv0307 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!

@mallenexpensify
Copy link
Contributor

I think.. hope.. we're all fixed here. Read the [POST MORTEM] Staging jobs not processing email for more deets. Thanks Ioni, Franc and Flo (what a trio of names!)

@mallenexpensify
Copy link
Contributor

Shit... on the latest desktop staging build and chats didn't load after restarting my computer and opening NewDot (I think I updated the app this morn too).

What I see in Desktop now
image

What I see when I open new.expensify.com in Firefox
image

Gonna share in the thread too

@mallenexpensify
Copy link
Contributor

Gonna close this cuz the initial bug here appears to be "I'm active in NewDot and new chats are showing in LHN" where my issue is "After having my laptop closed for some time, I opened Desktop and chats aren't sending (which is likely a reconnect issue)". More discussion here and a new thread for my specific bug here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutoAssignerNewDotQuality Used to assign quality issues to engineers Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
Development

No branches or pull requests