message: Fix duplicate `recently-pushed-branches`
diff: @@ -11,18 +11,26 @@ import select from 'select-dom';
  import features from '../libs/features';
  import {getRepoURL} from '../libs/utils';
  -const repoUrl = getRepoURL();
  -
  +const fragmentURL = `/${getRepoURL()}/show_partial?partial=tree%2Frecently_touched_branches_list`;
  +const selector = `[data-url='${fragmentURL}'], [src='${fragmentURL}']`;
  function getList(): HTMLElement {
  - const fragmentURL = `/${repoUrl}/show_partial?partial=tree%2Frecently_touched_branches_list`;
  -
  return (
  - select(`[data-url='${fragmentURL}'], [src='${fragmentURL}']`) // Get the one already on the page
  + select(selector) // Get the one already on the page
  || // eslint-disable-line operator-linebreak
  <include-fragment src={fragmentURL}></include-fragment> // Or generate it
  );
  }
  +// Ajaxed pages will load a new fragment on every ajaxed load;
  +// but we only really need the one generated on the first load
  +function removeDuplicateList(): void {
  + const duplicate = select(selector, select('main')!);
  +
  + if (duplicate) {
  + duplicate.remove();
  + }
  +}
  +
  async function init(): Promise<false | void> {
  // Make it smaller and `position:fixed` to avoid jumps
  document.body.classList.add('rgh-recently-pushed-branches');
  @@ -39,3 +47,12 @@ features.add({
  load: features.onDomReady,
  init
  });
  +
  +features.add({
  + id: 'recently-pushed-branches-enhancements',
  + include: [
  + features.isRepo
  + ],
  + load: features.onAjaxedPages,
  + init: removeDuplicateList
  +});
  