I did:
Meanwhile Signal downloaded some messages it didn't get while the PC was offline.
In the conversation where I placed the two messages, a couple of messages from the other person have been downloaded (according to the android client, those have been sent some hours ago).
Now the order is wrong, because my message A is before of one of the incoming messages, that the android client got some hours ago.
So it's:
message X is an image with caption, sent to me from the other person.
The android client displays the order correctly.
https://gist.github.com/anonymous/8a2dcfbe095b35729484
My version was on f2d2e08fa2be67005181307ad91b6f82a6c9c7cd
I observe the same behavior. Maybe the messages could be ordered by sent time?
Well, the loading screen does make one form of this harder to experience. But it still does happen when you bring a laptop out of sleep.
The core of this problem is that we sort messages based on when we process them, not when they were sent. We can't trust the sender's clock. There's no easy answer.
There are nicer approximates, though: You could refuse sending messages until a ws session is established and the queue empty message was received, and keep those stalled outgoing messages at the bottom of the conversation.
Some sort of local queue might be nice, leaving the to-be-sent messages in a pending state until the load is complete. Though I will say that we'll still have a set of users frustrated by that behavior as well. :0/
You could even send them - you just need to ensure that they are continuously moved to the bottom.
But first I'd fix the reordering issues before we add more complexity to it :)