Skip to content

fix(prompts): Query Fan-out track flashes the whole table to a skeleton instead of flipping just the row #346

Closed

Description

@gkhngyk

Problem

On the Prompts page → Query Fan-out tab, clicking + (Track) on a row makes the whole table flash to a loading skeleton and back before the row shows Tracked ✓. It looks like the page reloads on every track. Expected: clicking + flips just that row to Tracked ✓ instantly, with no skeleton and no full-table reload.

Root cause (from the code)

The track handler re-runs the same fetch used for the initial load, and that fetch flips the whole tab into its skeleton state.

In web/src/app/[locale]/(dashboard)/dashboard/prompts/_fanout-tab.tsx:

  • handleTrack() calls await trackFanoutQuery(...) then await load().
  • load() starts with setLoading(true), and the render is {loading ? <five Skeleton rows> : <table>} — so the entire table is replaced by skeletons until the refetch resolves, then swaps back.

So the skeleton flash is the initial-load spinner being reused for a post-track refresh.

Proposed change

Make the track update local and skeleton-free — mark only the acted row as tracked instead of re-fetching the whole tab:

  • On a successful trackFanoutQuery(...) (which returns { promptId }), update the row in local data state: set tracked: true and trackedPromptId to the returned id, so it flips to Tracked ✓ immediately.
  • Drop the await load() from handleTrack (no skeleton, no refetch). Keep the addingKey spinner on the + button itself while the server action is in flight (that part is already fine).

If a refresh of the aggregation is still wanted after tracking, do it silently (a background refetch that does not toggle the loading/skeleton state), not via the initial-load path.

Related

How to test

  1. Prompts → Query Fan-out, click + on an untracked sub-query.
  2. The row flips to Tracked ✓ immediately; the rest of the table stays put — no skeleton flash, no apparent reload.
  3. The + button still shows its inline spinner only while the request is in flight.

Activity

  1. added
    bug
    good first issue
    help wanted
    on Jul 6, 2026
  2. Sam-syntax35 commented on Jul 6, 2026

    @Sam-syntax35
    Contributor

    Hi @gkhngyk ! I'd like to work on this issue. Could you assign it to me?

  3. gkhngyk commented on Jul 6, 2026

    @gkhngyk
    ContributorAuthor

    Thanks @Sam-syntax35 — assigned to you! 🎉 The fix is to drop the await load() from handleTrack in _fanout-tab.tsx and instead flip just the tracked row in local state (set tracked: true + trackedPromptId from what trackFanoutQuery returns), keeping the inline spinner on the + button.

    Heads-up: #345 (assigned to @AyushSrivastava1818) touches the same handleTrack function (refreshing the All Prompts list on track). You two may want to coordinate — whoever merges second will just need a small rebase. Ping here if anything's unclear.

  4. gkhngyk commented on Jul 9, 2026

    @gkhngyk
    ContributorAuthor

    Hey @Sam-syntax35 — just a friendly check-in on this one, no pressure at all. 🙂

    Are you still planning to take it? If so, take your time — the fix is small and self-contained: in web/src/app/[locale]/(dashboard)/dashboard/prompts/_fanout-tab.tsx, on a successful trackFanoutQuery(...) update just the acted row in local data state (tracked: true + trackedPromptId from the returned id) and drop the await load() from handleTrack so the table no longer flashes its skeleton. Keep the addingKey button spinner as-is.

    If you'd rather focus on your other open PR (#368) and let this one go, that's totally fine too — just let us know and we'll leave it open for someone else to pick up. Thanks for all your contributions! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

buggood first issuehelp wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions