Fix read receipt animation (#12923)

* Fix read receipt animation

The way it was done involved remembering dom nodes and then getting
their position later when animating the receipt to its next position,
but I'm not sure how this worked since the DOM node may not neccessarily
be in the DOM anymore. Instead, just remember the bounding box coordinates.
At worst it might go weird if the window is resized but seems fine in
practice. Also, keeping references to dom nodes feels like a fast road
to memory leaks.

Fixes https://github.com/element-hq/element-web/issues/27916

* Attempt to write a test for read receipts

and fix naming

* Another test

also change a condition to make it testable
This commit is contained in:
David Baker 2024-09-03 12:59:30 +01:00 committed by GitHub
parent 5ff3fd67c4
commit 6bfdb3e16b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 109 additions and 54 deletions

View file

@ -60,7 +60,7 @@ import PlatformPeg from "../../../PlatformPeg";
import MemberAvatar from "../avatars/MemberAvatar";
import SenderProfile from "../messages/SenderProfile";
import MessageTimestamp from "../messages/MessageTimestamp";
import { IReadReceiptInfo } from "./ReadReceiptMarker";
import { IReadReceiptPosition } from "./ReadReceiptMarker";
import MessageActionBar from "../messages/MessageActionBar";
import ReactionsRow from "../messages/ReactionsRow";
import { getEventDisplayInfo } from "../../../utils/EventRenderingUtils";
@ -167,7 +167,7 @@ export interface EventTileProps {
// opaque readreceipt info for each userId; used by ReadReceiptMarker
// to manage its animations. Should be an empty object when the room
// first loads
readReceiptMap?: { [userId: string]: IReadReceiptInfo };
readReceiptMap?: { [userId: string]: IReadReceiptPosition };
// A function which is used to check if the parent panel is being
// unmounted, to avoid unnecessary work. Should return true if we