Repository navigation
Description
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(),awaitclassifyFanoutIntents(queries)(populatingintents) before flippingsetLoading(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 sharedintentsmap). - No extra network calls vs today (still one
classifyFanoutIntentsbatch).
Notes
- Presentation/timing only — no change to how intents are computed or cached.
Activity
Sam-syntax35 commentedon Jul 9, 2026
hey @gkhngyk !plz assign this to me
Sam-syntax35 commentedon Jul 9, 2026
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!