message: Avoid showing `conversation-activity-filter` in wrong position
diff: @@ -2,13 +2,14 @@ import './conversation-activity-filter.css';
  import delay from 'delay';
  import React from 'dom-chef';
  import select from 'select-dom';
  -import {observe} from 'selector-observer';
  +import elementReady from 'element-ready';
  import * as pageDetect from 'github-url-detection';
  import {CheckIcon, EyeClosedIcon, EyeIcon} from '@primer/octicons-react';
  import features from '.';
  import onNewComments from '../github-events/on-new-comments';
  import {removeClassFromAll, wrap} from '../helpers/dom-utils';
  +import onConversationHeaderUpdate from '../github-events/on-conversation-header-update';
  const states = {
  default: '',
  @@ -22,8 +23,6 @@ let currentSetting: State = 'default';
  const dropdownClass = 'rgh-conversation-activity-filter-dropdown';
  const hiddenClassName = 'rgh-conversation-activity-filtered';
  -const deinit: VoidFunction[] = [];
  -
  function isWholeReviewEssentiallyResolved(review: HTMLElement): boolean {
  const hasMainComment = select.exists('.js-comment[id^=pullrequestreview] .timeline-comment', review);
  if (hasMainComment) {
  @@ -120,7 +119,12 @@ function createRadio(filterSettings: State): JSX.Element {
  );
  }
  -function addWidget(position: Element): void {
  +async function addWidget(header: string): Promise<void> {
  + const position = (await elementReady(header))!.closest('div')!;
  + if (position.classList.contains('rgh-conversation-activity-filter')) {
  + return;
  + }
  +
  wrap(position, <div className="d-flex flex-items-baseline"/>);
  position.classList.add('rgh-conversation-activity-filter');
  position.after(
  @@ -147,17 +151,18 @@ function addWidget(position: Element): void {
  );
  }
  -function init(): void {
  - const observer = observe(':is(.gh-header-sticky .meta, .gh-header-meta .flex-auto):not(.rgh-conversation-activity-filter)', {
  - add: addWidget
  - });
  - deinit.push(observer.abort);
  +async function init(): Promise<void> {
  + await addWidget('#partial-discussion-header .gh-header-meta :is(clipboard-copy, .flex-auto)');
  + await addWidget('#partial-discussion-header .gh-header-sticky :is(clipboard-copy, relative-time)');
  }
  void features.add(__filebasename, {
  include: [
  pageDetect.isConversation
  ],
  - init,
  - deinit
  + additionalListeners: [
  + onConversationHeaderUpdate
  + ],
  + awaitDomReady: false,
  + init
  });
  