Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Fix tetris effect (holes) in read receipts #5697

Merged
merged 5 commits into from
Mar 2, 2021
Merged

Conversation

turt2live
Copy link
Member

Fixes element-hq/element-web#9769


Reviewer: this is split into a few commits for ease of review. There are lengthy explanations on the important commits - I highly encourage reviewing commit by commit.


This is the primary change in this PR: the new beta (which has been untouched for a year as of writing) actually does a better job of handling concurrent read receipts, this patching holes. 

The beta doesn't have the same leak as v1, so we can remove the metadata hack from our side (it doesn't use jQuery's data anymore).

Note that this change on its own introduces an annoying bug where every second update to a read receipt will throw it 14px to the right - more on that in the next commit.
As mentioned in 208faf6, the velocity-animate update causes read receipts to occasionally show up 14px to the right of where they should be. This is because the read receipt width is 14px, and velocity-animate will *not* translate `left` if it isn't changing. Unfortunately, it's smart enough to realize that `-0px` is `0px`, so we end up having to specify `1px`. 

The comment already mentions it, but this should have no perceived effect for the user. During development I could not tell if the 1px was being applied during the animation, implying that it's a meaningless value. It's a bit unfortunate for those who know that it's translating left by 1px, but hopefully they'll be able to unsee that in time.
We can make read receipts more efficient (and avoid double-animation) by using `PureComponent` which no-ops useless updates for us.
This appears to have been removed in the beta
Copy link
Collaborator

@jryans jryans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me, thanks! 😄

@turt2live turt2live merged commit 303ea16 into develop Mar 2, 2021
@turt2live turt2live deleted the travis/fix-tetris branch March 2, 2021 14:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Read receipt animation sometimes has holes in it
3 participants