useRunDetails()
The useRunDetails()
React hook will show the live status of run.
These are the docs for Trigger.dev v2 which will be deprecated on January 31st, 2025. You probably want the v3 docs.
This hook will automatically update until the run has either completed or failed.
There are a couple of ways you can get a runId to pass in:
- In the frontend you can get the runId from the
useEventDetails()
hook. Although if you want the first run triggered by an event, we suggest you use useEventRunDetails(). - From the backend you can get the latest runs for a Job using the client.getRuns() method. This will return an array of runs, including their ids. You can then pass an id to your frontend to display the live status.
You can get the full status of a Run from the backend using the client.getRun() method.
If you're familiar with React Query, you'll recognize the data that is returned by this hook. React Query 5 is used internally.
Parameters
The run ID to get the details for.
Returns
The data returned from the server.
The error object if the request failed.
The status of the request. This can be one of the following values: pending
,
success
and error
.
true
if the request is currently pending or if it is in a refetch
state.
true
if the request succeeded.
true
if the request failed.
true
if the request is currently pending.
true
if the request failed with a loading error.
true
if the request failed with a refetch error.