message: Fix `onNewComments` listener
diff: @@ -4,7 +4,17 @@ import delegate from 'delegate-it';
  const discussionsWithListeners = new WeakSet();
  const handlers = new Set<VoidFunction>();
  const delegates = new Set<delegate.Subscription>();
  -const observer = new MutationObserver(run);
  +
  +let commentsCount = 0;
  +const observer = new MutationObserver(() => {
  + const commentsNewCount = select.all('.js-comment').length;
  + if (commentsNewCount > commentsCount) {
  + commentsCount = commentsNewCount; // Update the count ASAP to avoid duplicate calls
  + run();
  + }
  +
  + commentsCount = commentsNewCount;
  +});
  function run(): void {
  // Run all callbacks without letting an error stop the loop and without silencing it
  @@ -49,6 +59,7 @@ function addListeners(): void {
  document.addEventListener('pjax:beforeReplace', removeListeners);
  // When new comments come in via AJAX
  + commentsCount = select.all('.js-comment').length;
  observer.observe(discussion, {
  childList: true,
  });
  @@ -57,7 +68,7 @@ function addListeners(): void {
  delegates.add(delegate(document, '.js-ajax-pagination', 'submit', paginationSubmitHandler));
  // Collapsed comments are loaded later using an include-fragment element
  - delegates.add(delegate(document, 'details.js-comment-container include-fragment', 'loadstart', getFragmentLoadHandler(run), true));
  + delegates.add(delegate(document, 'details.js-comment-container include-fragment:not([class])', 'loadstart', getFragmentLoadHandler(run), true));
  }
  export default function onNewComments(callback: VoidFunction): void {
  