Skip to content

Commit

Permalink
Improve reliability of reactions-avatar (#4858)
Browse files Browse the repository at this point in the history
  • Loading branch information
cheap-glitch committed Oct 4, 2021
1 parent 58fa640 commit c1f3484
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions source/features/reactions-avatars.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {flatZip} from 'flat-zip';
import * as pageDetect from 'github-url-detection';

import features from '.';
import onReplacedElement from '../helpers/on-replaced-element';
import {getUsername} from '../github-helpers';
import onElementRemoval from '../helpers/on-element-removal';

const arbitraryAvatarLimit = 36;
const approximateHeaderLength = 3; // Each button header takes about as much as 3 avatars
Expand Down Expand Up @@ -67,9 +67,8 @@ async function showAvatarsOn(commentReactions: Element): Promise<void> {
);
}

const trackableElement = commentReactions.closest<HTMLElement>('[data-body-version]')!;
const trackingSelector = `[data-body-version="${trackableElement.dataset.bodyVersion!}"]`;
await onReplacedElement(trackingSelector, init);
await onElementRemoval(commentReactions.closest('.comment-reactions')!);
init();
}

const viewportObserver = new IntersectionObserver(changes => {
Expand Down

0 comments on commit c1f3484

Please sign in to comment.