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

Commit

Permalink
Add missing return values in Read Receipt animation code (#8625)
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy authored May 17, 2022
1 parent 796e12e commit 5976f59
Showing 1 changed file with 6 additions and 12 deletions.
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

0 comments on commit 5976f59

Please sign in to comment.