message: Restore `scheduled-and-manual-workflow-indicators` again
diff: @@ -3,12 +3,12 @@ import React from 'dom-chef';
  import select from 'select-dom';
  import {PlayIcon} from '@primer/octicons-react';
  import {parseCron} from '@cheap-glitch/mi-cron';
  -import elementReady from 'element-ready';
  import * as pageDetect from 'github-url-detection';
  import features from '../feature-manager';
  import * as api from '../github-helpers/api';
  import {getRepo} from '../github-helpers';
  +import observe from '../helpers/selector-observer';
  type WorkflowDetails = {
  schedule?: string;
  @@ -65,22 +65,21 @@ const getWorkflowsDetails = cache.function(async (): Promise<Record<string, Work
  cacheKey: () => 'workflows:' + getRepo()!.nameWithOwner,
  });
  -async function init(): Promise<false | void> {
  +async function addIndicators(workflowListItem: HTMLAnchorElement): Promise<void> {
  + // Memoized above
  const workflows = await getWorkflowsDetails();
  if (!workflows) {
  - return false;
  + return; // Impossibru, for types only
  }
  - const workflowsSidebar = await elementReady('.ActionList');
  - for (const workflowListItem of select.all('a.ActionList-content[href*="/workflows/"]', workflowsSidebar)) {
  if (select.exists('.octicon-stop', workflowListItem)) {
  - continue;
  + return;
  }
  const workflowName = workflowListItem.href.split('/').pop()!;
  const workflow = workflows[workflowName];
  if (!workflow) {
  - continue;
  + return;
  }
  if (workflow.manuallyDispatchable) {
  @@ -88,10 +87,13 @@ async function init(): Promise<false | void> {
  addTooltip(workflowListItem, 'This workflow can be triggered manually');
  }
  - if (workflow.schedule) {
  + if (!workflow.schedule) {
  + return;
  + }
  +
  const nextTime = parseCron.nextDate(workflow.schedule);
  if (!nextTime) {
  - continue;
  + return;
  }
  const relativeTime = <relative-time datetime={String(nextTime)}/>;
  @@ -105,7 +107,15 @@ async function init(): Promise<false | void> {
  addTooltip(workflowListItem, 'Next run in ' + relativeTime.textContent!);
  }, 500);
  }
  +
  +async function init(signal: AbortSignal): Promise<false | void> {
  + // Do it as soon as possible, before the page loads
  + const workflows = await getWorkflowsDetails();
  + if (!workflows) {
  + return false;
  }
  +
  + observe('a.ActionList-content', addIndicators, {signal});
  }
  void features.add(import.meta.url, {
  @@ -113,7 +123,6 @@ void features.add(import.meta.url, {
  pageDetect.isRepositoryActions,
  ],
  awaitDomReady: false,
  - deduplicate: 'has-rgh-inner',
  init,
  });
  