Repository navigation
Description
Problem
On the Prompts page, clicking + (Track) on a row in the Query Fan-out tab does add the sub-query as a tracked prompt — but the All Prompts tab still shows the old list. A user who switches to All Prompts to confirm the addition doesn't see the new prompt and concludes it wasn't added. The prompt is there (a page reload or brand switch reveals it); only the in-memory list is stale.
Root cause (from the code)
The Prompts page is a client component that loads the All Prompts data once into local state, and the Query Fan-out tab refreshes only its own data after a track — the two never talk to each other.
- The page holds
allPromptsinuseStateand populates it inloadData(); every other mutating action on the page (analyze,refresh, etc.) callsawait loadData()afterwards to re-sync. Seeweb/src/app/[locale]/(dashboard)/dashboard/prompts/page.tsx—allPrompts/setAllPrompts,loadData, and the<QueryFanoutTab brandId={activeBrandId} />render (which is passed no refresh callback). - The fan-out tab's track handler adds the prompt and then reloads only the fan-out aggregation (so its own row flips to Tracked ✓), but it has no way to tell the page to refresh
allPrompts. Seeweb/src/app/[locale]/(dashboard)/dashboard/prompts/_fanout-tab.tsx—handleTrack→trackFanoutQuery→await load(). trackFanoutQuerycallsrevalidatePath('/dashboard/prompts')(web/src/lib/actions/fanout.ts), but the page keeps its list in clientuseState, so path revalidation doesn't re-sync that in-memory state without a navigation/refresh.
Proposed change
Give the fan-out tab a way to trigger the page's existing refresh so the All Prompts list reflects the new prompt immediately:
- Add an
onTracked?: () => void(oronTracked?: () => Promise<void>) prop toQueryFanoutTab, called after a successfultrackFanoutQuery. - Wire it at the render site to the page's
loadData(mirrors how the analyze/refresh actions already re-sync):<QueryFanoutTab brandId={activeBrandId} onTracked={loadData} />.
That's the whole fix — no new data flow, just reusing the page's loadData. (Optionally, only re-fetch the prompt list rather than all page data if a lighter refresh is preferred.)
How to test
- Prompts → Query Fan-out, click + on an untracked sub-query → toast confirms, the row flips to Tracked ✓.
- Switch to All Prompts without reloading the page → the newly tracked sub-query now appears in the list (previously it did not until a manual reload).
- The KPI/"unanalyzed keywords" counts that derive from
allPromptsalso reflect the new prompt.
Notes
- Depends on the Query Fan-out feature (feat(prompts): Query Fan-out tab — observed sub-queries with times-searched + one-click track #342 / feat(prompts): Query Fan-out tab — observed engine sub-queries with times-searched + one-click track #333).
- Small, self-contained UI wiring — good first issue.
Activity
AyushSrivastava1818 commentedon Jul 6, 2026
Can I work on this??
gkhngyk commentedon Jul 6, 2026
Thanks @AyushSrivastava1818 — assigned to you, it's all yours! 🎉 The fix is small: give
QueryFanoutTabanonTrackedprop and wire it to the page's existingloadDataso the All Prompts list re-syncs after a track (details in the issue). Feel free to ask here if anything's unclear.