Polling tiers

POLL_CRITICAL, POLL_ACTIVE, POLL_AMBIENT — pick the right refetchInterval for the page.

Pick the interval that matches how fresh the data needs to feel. Different queries on the same page can mix tiers — poll the status field fast, poll the metadata slow.

ConstantIntervalUse for
POLL_CRITICAL2sStale data is misleading — run details while running, live status chips
POLL_ACTIVE5sLists the user is actively watching — runs list, recent events, dashboards
POLL_AMBIENT30sBackground freshness — settings, overviews, detail views
POLL_FALLBACK60sSafety-net interval used automatically when the event stream is connected
POLL_IDLE5mCold data that only changes on explicit user action — table browsers, schema viewers

Using a tier

TSX
import { POLL_ACTIVE, useListRuns } from "@aeontel/react";

function RunsList({ workspaceId }: { workspaceId: string }) {
  const { data } = useListRuns(
    { workspace_id: workspaceId, status: "running" },
    { refetchInterval: POLL_ACTIVE },
  );
  return <RunsTable rows={data?.data ?? []} />;
}

Throttling to a safety-net when events are live

Pair polling with useEventStream and getRefetchInterval — when the WebSocket is connected, intervals drop to the 60s safety-net.

TSX
import {
  getRefetchInterval,
  useEventStream,
  useListRuns,
} from "@aeontel/react";

function RunsList({ workspaceId }: { workspaceId: string }) {
  const { connected } = useEventStream(workspaceId);
  const { data } = useListRuns(
    { workspace_id: workspaceId },
    { refetchInterval: getRefetchInterval("active", connected) },
  );
  return <RunsTable rows={data?.data ?? []} />;
}