Skip to content

bug: useRealtimeRun hook onComplete triggers on QUEUED state #2001

@cachho

Description

@cachho

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

Image

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions