decent
decent copied to clipboard
Images in messages cause auto-scrolldown to not work sometimes
The bug
Sometimes, if an image embedded in a message takes long to load, the client doesn't automatically scroll down to the latest message when (re)loading a channel. This is probably caused by the image not taking up any vertical space until it's loaded.
It may not just be images.
A solution
Know the height/size of each image (how?) before we emit render, and apply some kind of filler image whilst it is loading, but with the correct dimensions. Discord does this with a little load animation.
apply some kind of filler image whilst it is loading
https://codepen.io/PullJosh/pen/ppEXbK?editors=1100
That looks great! Only thing left to do is pre-fetch the height of the image before we render. No idea how we'll do that; we may just have to force every image into a, say, 400px-high box that (even without an image in it) is always that height. Should fix this. I think/hope.
This is a total hack and I feel dirty for even recommending it, but... Could you include the dimensions of the image in the filename (on upload), and then use JS to check those dimensions when the image is displayed?
No, because it's not just images that have been uploaded to the server that can be displayed. You can embed any image from any site using markdown syntax.
Closing because this seems to be irrelevant with the preact client. Feel free to reopen if I'm wrong.
Preact client doesn't currently parse markdown or display messages. Solving this will be significantly easier with preact though,
Oops! Yes. Got a little overzealous with my issue killing spree, it seems.