trigger.dev
trigger.dev copied to clipboard
bug: `useRealtimeRun` hook `onComplete` triggers on `QUEUED` state
Provide environment information
System: OS: Linux 5.15 Ubuntu 20.04.6 LTS (Focal Fossa) CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor Memory: 2.98 GB / 15.59 GB Container: Yes Shell: 3.7.1 - /usr/bin/fish Binaries: Node: 18.20.8 - ~/.local/share/nvm/v18.20.8/bin/node npm: 10.8.2 - ~/.local/share/nvm/v18.20.8/bin/npm pnpm: 8.6.3 - ~/.local/share/pnpm/pnpm
Describe the bug
Reproduction repo
n/a
To reproduce
const { run, error } = useRealtimeRun<typeof decryptLink>(runId, {
accessToken: publicAccessToken,
// eslint-disable-next-line @typescript-eslint/no-shadow
onComplete: (run) => {
console.log('🚀 ~ run (onComplete):', run);
setIsLoading(false);
if (run.output) {
callback({
url: new URL(run.output),
isRandom: false,
router,
});
}
},
});
Additional information
beta 4.11
the easiest fix is to check for the status in the onComplete callback
Actually, it only runs on QUEUED and not as intended on failed or completed.
facing the same issue