Skip to content

Commit b308308

Browse files
committed
docs: document skipColumns for realtime hooks to reduce payload size
1 parent 1d744fa commit b308308

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/realtime/react-hooks/subscribe.mdx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,32 @@ export function MyComponent({
9393
}
9494
```
9595

96+
When you only need run status (for example, a progress bar or completion badge), you can omit large fields like `payload` and `output` by passing `skipColumns`. This reduces the data sent over the wire and avoids issues such as "Large HTTP Payload" warnings in tools like Sentry.
97+
98+
```tsx
99+
import { useRealtimeRun } from "@trigger.dev/react-hooks";
100+
101+
export function RunStatusBadge({
102+
runId,
103+
publicAccessToken,
104+
}: {
105+
runId: string;
106+
publicAccessToken: string;
107+
}) {
108+
const { run, error } = useRealtimeRun(runId, {
109+
accessToken: publicAccessToken,
110+
skipColumns: ["payload", "output"],
111+
});
112+
113+
if (error) return <span>Error</span>;
114+
if (!run) return <span>Loading…</span>;
115+
116+
return <span>Status: {run.status}</span>;
117+
}
118+
```
119+
120+
You can skip any of: `payload`, `output`, `metadata`, `startedAt`, `delayUntil`, `queuedAt`, `expiredAt`, `completedAt`, `number`, `isTest`, `usageDurationMs`, `costInCents`, `baseCostInCents`, `ttl`, `payloadType`, `outputType`, `runTags`, `error`. The `useRealtimeRunsWithTag` hook also accepts a `skipColumns` option in the same way.
121+
96122
See our [run object reference](/realtime/run-object) for the complete schema and [How it Works documentation](/realtime/how-it-works) for more technical details.
97123

98124
### useRealtimeRunsWithTag

0 commit comments

Comments
 (0)