airmessage-web icon indicating copy to clipboard operation
airmessage-web copied to clipboard

need an additional scrollToBottom on incoming messages

Open davedgd opened this issue 3 years ago • 9 comments

Thanks for putting this together -- it's awesome!

One annoyance I've noticed: When sending messages, the scrollToBottom calls successfully scroll the div containing messages to the bottom. However, this is not true when you're in an existing chat and receive messages from the other party. For instance:

example

It would be great if incoming messages would trigger a scrollToBottom event as well. I haven't had the time to dig into the code to put together a PR yet, but I imagine this is a relatively simple fix.

davedgd avatar Jul 09 '21 19:07 davedgd

Thanks for opening this issue!

AirMessage for web doesn't call scrollToBottom() for incoming messages, since if the conversation list is already scrolled to the bottom, the browser should scroll down to reveal any newly added items automatically:

https://user-images.githubusercontent.com/13751213/126004241-c53451a0-2158-4bd4-bcd7-71fa61876466.mov

Is this not the behaviour you're experiencing?

tagavari avatar Jul 16 '21 20:07 tagavari

Hi @tagavari!

You're very welcome, and thanks for the reply!

I think I need to clarify my original post: I do experience the behavior you showed in your movie most of the time, but occasionally not.

Sometimes -- perhaps when the airmessage tab has been out of focus, but I'm still confirming -- received messages, along with the first outbound message, will fail to scroll to the bottom as expected.

I'm not able to recreate it at the moment, but I will try to create a video of it once I can show how to reproduce.

EDIT: Here's a demonstration of the issue with incoming messages. It can also occur with outbound messages sent very quickly (before the server has time to update it would seem). Notice in the clip, I'm receiving inbound messages (three in this case), and the scrollbar is moving, but the initial message is cut off, along with all subsequent ones.

To create the situation, I switched between two conversations and also backgrounded the tab briefly (I'm not yet 100% sure what causes it, but I encounter it pretty frequently).

https://user-images.githubusercontent.com/4490587/126012212-4fca1c28-95f2-4106-aaf1-14db621a457f.mp4

davedgd avatar Jul 16 '21 21:07 davedgd

i fixed this issue here: https://github.com/Geczy/airmessage-web/commit/c8b26ec49725d37f246945cbf21ee22e110a17e9 feel free to cherry pick !

Geczy avatar Jul 23 '22 17:07 Geczy

@Geczy Thanks a lot! I tried this out, but it seems to trigger even if I've scrolled far up in the conversation. Am I missing something?

tagavari avatar Jul 23 '22 18:07 tagavari

@Geczy Thanks a lot! I tried this out, but it seems to trigger even if I've scrolled far up in the conversation. Am I missing something?

can you share the branch you tried this in?

nvm i can see this happening in mine too, will think of a fix

Geczy avatar Jul 23 '22 20:07 Geczy

okay this commit fixes it for sure https://github.com/Geczy/airmessage-web/commit/5856eb0c42367bb93a14d60a2a553f447762f0e7

Geczy avatar Jul 23 '22 23:07 Geczy

okay this commit fixes it for sure Geczy@5856eb0

Thank you both for working on this!

davedgd avatar Jul 23 '22 23:07 davedgd

Thank you @Geczy, I will try this out later this week!

tagavari avatar Jul 25 '22 20:07 tagavari

hi,

I've tried that function, but images are downloaded again-and-again every time I click on the chat. The loading takes 8-10 seconds, and sometimes I get 'Couldn't load this conversation'. It this the normal behaviour? Or should I deploy this repo for myself, and it would be faster?:)

dyipon avatar Sep 15 '22 15:09 dyipon