airmessage / airmessage-web

AirMessage for the web
https://web.airmessage.org
Apache License 2.0
156 stars 12 forks source link

need an additional scrollToBottom on incoming messages #2

Open davedgd opened 3 years ago

davedgd commented 3 years ago

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.

tagavari commented 3 years ago

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?

davedgd commented 3 years ago

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

Geczy commented 2 years ago

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

tagavari commented 2 years ago

@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?

Geczy commented 2 years ago

@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 commented 2 years ago

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

davedgd commented 2 years ago

okay this commit fixes it for sure Geczy@5856eb0

Thank you both for working on this!

tagavari commented 2 years ago

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

dyipon commented 1 year ago

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?:)