---
title: "Polling tiers"
description: "POLL_CRITICAL, POLL_ACTIVE, POLL_AMBIENT — pick the right refetchInterval for the page."
section: "Libraries"
group: "React"
---

# Polling tiers

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.

| Constant        | Interval | Use for                                                                              |
| --------------- | -------- | ------------------------------------------------------------------------------------ |
| `POLL_CRITICAL` | 2s       | Stale data is misleading — run details while running, live status chips              |
| `POLL_ACTIVE`   | 5s       | Lists the user is actively watching — runs list, recent events, dashboards           |
| `POLL_AMBIENT`  | 30s      | Background freshness — settings, overviews, detail views                             |
| `POLL_FALLBACK` | 60s      | Safety-net interval used automatically when the event stream is connected            |
| `POLL_IDLE`     | 5m       | Cold 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 ?? []} />;
}
```
