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

Add missing return values in Read Receipt animation code #8625

Merged
merged 1 commit into from
May 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions src/components/views/rooms/ReadReceiptMarker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,29 +129,25 @@ export default class ReadReceiptMarker extends React.PureComponent<IProps, IStat
// this seems to happen sometimes for reasons I don't understand
// the docs for `offsetParent` say it may be null if `display` is
// `none`, but I can't see why that would happen.
logger.warn(
`ReadReceiptMarker for ${this.props.fallbackUserId} has no valid horizontalContainer`,
);
logger.warn(`ReadReceiptMarker for ${this.props.fallbackUserId} has no valid horizontalContainer`);

target.top = 0;
target.right = 0;
target.parent = null;
return;
return target;
}
// this is the mx_ReadReceiptsGroup
const verticalContainer = horizontalContainer.offsetParent;
if (!verticalContainer || !(verticalContainer instanceof HTMLElement)) {
// this seems to happen sometimes for reasons I don't understand
// the docs for `offsetParent` say it may be null if `display` is
// `none`, but I can't see why that would happen.
logger.warn(
`ReadReceiptMarker for ${this.props.fallbackUserId} has no valid verticalContainer`,
);
logger.warn(`ReadReceiptMarker for ${this.props.fallbackUserId} has no valid verticalContainer`);

target.top = 0;
target.right = 0;
target.parent = null;
return;
return target;
}

target.top = element.offsetTop;
Expand All @@ -165,9 +161,7 @@ export default class ReadReceiptMarker extends React.PureComponent<IProps, IStat
// this seems to happen sometimes for reasons I don't understand
// the docs for `offsetParent` say it may be null if `display` is
// `none`, but I can't see why that would happen.
logger.warn(
`ReadReceiptMarker for ${this.props.fallbackUserId} has no offsetParent`,
);
logger.warn(`ReadReceiptMarker for ${this.props.fallbackUserId} has no offsetParent`);
return 0;
}

Expand All @@ -186,7 +180,7 @@ export default class ReadReceiptMarker extends React.PureComponent<IProps, IStat
: -READ_AVATAR_SIZE;

const startStyles = [];
if (oldInfo && oldInfo.right) {
if (oldInfo?.right) {
startStyles.push({
top: oldPosition - newPosition,
right: oldInfo.right,
Expand Down