Hold each status label long enough to read, and skip the ones that were replaced while it was showing.

The problem

Agents narrate. “Reading the page”, “Checking 14 orders”, “Writing the filter”, sometimes 80ms apart. Wire that straight to a label and it strobes. Nobody can read it, and it makes the work look frantic.

The obvious fix, a queue, is worse. It replays every stale status long after the work has moved on.

What I concluded

Use a hook that holds whatever it’s showing for a minimum time. Values that arrive during the hold don’t queue up. They collapse to the latest one, so the in-between labels are skipped entirely.

function useHeldValue(value, minMs) {
  const [shown, setShown] = useState(value);
  const since = useRef(performance.now());
  const latest = useRef(value);
  latest.current = value;
  useEffect(() => {
    if (value === shown) return;
    const show = () => {
      since.current = performance.now();
      setShown(latest.current);
    };
    const wait = minMs - (performance.now() - since.current);
    if (wait <= 0) return show();
    const t = setTimeout(show, wait);
    return () => clearTimeout(t);
  }, [value, shown, minMs]);
  return shown;
}

It also makes accessibility work. A live region wired to the raw stream tries to announce every status and falls further behind each time. Held, it announces each label it can actually finish. In the demo, only the held pill is a live region.

Rules

  • Hold, don’t queue. The latest value wins. Anything superseded is dropped.
  • Show the new value right away if the hold is over. Holding only delays changes that come too fast.
  • Only held labels go in live regions. The raw stream is too fast to announce.
  • Keep labels short. A held label still only gets a moment.

What you get

Status becomes something you can read, the work looks calm instead of frantic, and screen readers get labels they can finish.

Related: Streaming, AI icon, Step tree