fix(tasks): gate the task and run page skeletons on isPending so the not-found copy cannot flash (app#2016 item 4)

Merged
SW
3mo ago
+113-21

Item 4 of app#2016. On a hard load of /tasks/{id} the page showed "No task with this id on your account." first, then the skeleton, then the task.

Why

useTask (and useTaskRunStatus) are enabled: !!id && authenticated. Until Privy restores the session the query is disabled, and TanStack Query v5 reports a disabled, never-fetched query as status: "pending" with isLoading (isPending && isFetching) false and data undefined. TaskPage checked isLoading first, then error || !task, so the auth-wait window rendered the not-found branch.

What changes

  • TaskPage: the skeleton is gated on isPending, which is true through both the auth wait and the fetch; the not-found copy only renders after the query resolves to null or throws.
  • RunPage: same guard, replacing isLoading || !data. Side effect: its error branch is now reachable (before, a failed query left data undefined and stayed on the skeleton).

Tests

RED → GREEN: TaskPage (pending + not fetching → skeleton, no role="status" copy; resolved null → not-found copy) and a new RunPage test (pending → skeleton; error → message; data → details). components/TasksPage: 15 passing; eslint, prettier and tsc clean on the touched files.

Verification

Preview: hard load of a real task id sampled every 100ms from navigation until the task renders; documented-vs-actual table with the sequence of states in a comment below, alongside the same probe on prod (which reproduces the flash).

🤖 Generated with Claude Code

https://claude.ai/code/session_012PS8hmiwR1rGD6c41n6gD8


Summary by cubic

Stops the "No task with this id on your account." copy from flashing before the skeleton on hard loads of /tasks/{id} and run pages. The query stays disabled until Privy restores the session, and TanStack Query v5 reports a disabled, never-fetched query as pending but not loading, so the old isLoading guard fell through to the not-found branch during the auth wait.

Both TaskPage and RunPage now gate their skeletons on isPending, which stays true through the auth wait and the fetch. Side effect: RunPage's error branch is now reachable instead of leaving the page on the skeleton after a failed query.