SWR hooks use the swr library to fetch data once and cache it. These hooks are useful when you need to fetch data without real-time updates.Documentation Index
Fetch the complete documentation index at: https://trigger-docs-mcp-readonly-runtime-flag.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
While SWR can be configured to poll for updates, we recommend using our other Realtime
hooks for most use-cases due to rate-limits and the way the Trigger.dev
API works.
useRun
TheuseRun hook allows you to fetch a run by its ID.
run object returned is the same as the run object returned by the Trigger.dev API. To correctly type the run’s payload and output, you can provide the type of your task to the useRun hook:
Common SWR options
You can pass the following options to the all SWR hooks:Revalidate the data when the window regains focus.
Revalidate the data when the browser regains a network connection.
Poll for updates at the specified interval (in milliseconds). Polling is not recommended for most
use-cases. Use the Realtime hooks instead.
Common SWR return values
An error object if an error occurred while fetching the data.
A boolean indicating if the data is currently being fetched.
A boolean indicating if the data is currently being revalidated.
A boolean indicating if an error occurred while fetching the data.

