Skip to content

ux(prompts): Query Fan-out Intent column pops in a few seconds after the table loads #380

Closed

Description

@gkhngyk

Problem

On the Prompts page → Query Fan-out tab (/dashboard/prompts?tab=fanout), the table paints first and the Intent column stays empty (a — placeholder) for a few seconds, then the intent badges pop in afterward. It reads as if the row loaded broken and got patched a moment later. Expected: the table and its Intent badges appear together, as one complete load.

Root cause (from the code)

In web/src/app/[locale]/(dashboard)/dashboard/prompts/_fanout-tab.tsx, intent classification is intentionally non-blocking:

const result = await getQueryFanout(brandId, { days: 30 });
setData(result);            // table paints immediately
// non-blocking: badges fill in when this resolves
classifyFanoutIntents(queries)
  .then((map) => setIntents((prev) => ({ ...prev, ...map })))
  .catch(() => {});
setLoading(false);

IntentBadge renders a — placeholder until the row's intent resolves. Since classifyFanoutIntents is an LLM classification round-trip, the badges land a few seconds after the table — hence the pop-in. (It's cached server-side, so it's slow only on the first classification of a given set of sub-queries; repeat loads are fast.)

Proposed change

Fold the intent fetch into the initial load so the table and Intent badges paint together, with a timeout fallback so a slow first-time classification never blocks the table indefinitely:

  • In load(), await classifyFanoutIntents(queries) (populating intents) before flipping setLoading(false) — but race it against a short timeout (e.g. ~1.5s).
  • If intents resolve within the timeout (the common, cached case): the table renders once, fully populated — no pop-in.
  • If they don't (rare first-time/slow case): fall back to today's behavior — paint the table now and let the badges fill in when they arrive, so we never hold the whole tab on a skeleton waiting for the LLM.
  • Keep the server-side cache and the — placeholder as the fallback state.

Acceptance criteria

  • On a normal (cached) load, the Query Fan-out table and its Intent badges appear at the same time — no visible pop-in.
  • A slow/first-time intent classification does not block the table beyond the timeout; it still degrades to the current fill-in-later behavior.
  • Applies to both the High-frequency view and the By-prompt view (both use IntentBadge / the shared intents map).
  • No extra network calls vs today (still one classifyFanoutIntents batch).

Notes

  • Presentation/timing only — no change to how intents are computed or cached.

Activity

  1. added
    enhancement
    on Jul 9, 2026
  2. Sam-syntax35 commented on Jul 9, 2026

    @Sam-syntax35
    Contributor

    hey @gkhngyk !plz assign this to me

  3. Sam-syntax35 commented on Jul 9, 2026

    @Sam-syntax35
    Contributor

    Hi @gkhngyk, could you please assign these issues to me? I've already started working on them, and assigning them will help avoid duplicate PRs. Thanks!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions