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

Web and Desktop don't load unread chats when computer awakens from sleep #504

Closed
mallenexpensify opened this issue Sep 16, 2020 · 11 comments
Assignees

Comments

@mallenexpensify
Copy link
Contributor

Problem
When a computer is Sleeping (I closed my laptop) and new chats are sent, they don't show as in LHN once the computer is awakened (desktop chat remained open during sleep).
I've seen this a handful of times but wasn't sure of the exact issue. I just tested with Joe and Jeremy and they didn't show up, Mitch sent me a message soon after and it does show as unread (still nothing from Joe or Jez). When I refresh Desktop all unread messages show.
I was able to replicate this issue using the same steps above but only on web.

I also tested by going into Screensaver mode (via hot corner) instead of Sleep and the chat's loaded correctly on Desktop

Solution
See how we can fix it, my guess is it's something to do with Pusher

@mallenexpensify
Copy link
Contributor Author

mallenexpensify commented Sep 16, 2020

I have a feeling the two issues below are related to this too
DM Chat message sent by Jeremy to me didn't show up in web chat #388
Messages being sent via email but NOT showing up in chat #490

@mallenexpensify mallenexpensify changed the title Web and Desktop don't load unread chats when computer awakes from sleep Web and Desktop don't load unread chats when computer awakens from sleep Sep 16, 2020
@marcaaron marcaaron self-assigned this Sep 16, 2020
@marcaaron
Copy link
Contributor

Trying to repro now.

@mallenexpensify
Copy link
Contributor Author

Exact steps would be...

  • open/update Chat to make sure you're on the latest :)
  • leave Chat open then put your computer into sleep state
  • via Slack on phone, ping someone (me.. me....) to send you a message via Chat and confirm it's sent via Slack.
  • Awaken computer, Chat should already be open and the new, unread chat should not show

@marcaaron
Copy link
Contributor

Ok I think I figured this out.

TL;DR we are listening to various state_change events which can all be seen here:
https://pusher.com/docs/channels/using_channels/connection#available-states

However, unless if the state_change event is something other than connecting or unavailable we set the offline status to "online". That's bad because a few of these state changes are very indicative of being "offline"... such as failed and the ever popular disconnected

https://github.com/Expensify/ReactNativeChat/blob/12df2846f0954b0456b09a831a0bcf21fe8ff557/src/lib/API.js#L311-L332

@marcaaron
Copy link
Contributor

Fix incoming.

@Jag96
Copy link
Contributor

Jag96 commented Sep 21, 2020

Fixed by #505

@Jag96 Jag96 closed this as completed Sep 21, 2020
@conorpendergrast
Copy link
Contributor

This happened to me again today with a DM from @flaviafaria on v1.0.1-63, where the chat wasn't shown in the desktop app but was sent via email to me. Need any more specific details to help with that?

@marcaaron
Copy link
Contributor

the chat wasn't shown in the desktop app but was sent via email to me

Yes, if it happens again please share JS console logs you can access them by holding command + option + i

@marcaaron
Copy link
Contributor

Some useful information would be:

Was the desktop app open and in view or in the background?
Were you viewing the report where you expected to see the new comment?
etc

@marcaaron
Copy link
Contributor

I'm going to close this as it sounds like this might be the correct issue

#490

@mallenexpensify
Copy link
Contributor Author

@marcaaron is this issue and #505 both 'fixed' in v.63?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants