Repository navigation
feat(content): show prompt's observed query fan-outs in Source Data (#392) - #405
Merged
gkhngyk merged 1 commit intoJul 11, 2026
Merged
Conversation
…392) Adds an 'Observed fan-out queries' block to the Source Data card on the content opportunity detail page (/dashboard/content/[id]). Changes: - web/src/lib/actions/fanout.ts: add getPromptFanout(brandId, promptId) server action — filters prompt_results by both brand_id and prompt_id, applies the same normalise/dedupe/count-distinct-answers aggregation as getQueryFanout, returns QueryFanoutData - web/src/app/[locale]/(dashboard)/dashboard/content/[id]/page.tsx: - import getPromptFanout and FanoutSubQuery - add fanoutQueries state (FanoutSubQuery[]) - load fan-out inside existing getOpportunity().then() when opp.brandId and opp.promptId are present; errors caught silently - render fan-out chips (violet) below Keywords block, each showing query text + times-searched count - block hidden entirely when fanoutQueries is empty Closes #392
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #392
Adds an Observed fan-out queries block to the Source Data card on
/dashboard/content/[id], showing the sub-queries answer enginesactually ran when answering this opportunity's prompt — first-hand
demand signal for content writers.
Changes
web/src/lib/actions/fanout.tsAdded
getPromptFanout(brandId, promptId, opts?)— a new server actionthat filters
prompt_resultsby bothbrand_idandprompt_id(30-dayrolling window by default, clamped to
MAX_FANOUT_DAYS). Aggregation isidentical to
getQueryFanout: normalize whitespace/case, dedupe peranswer row so one answer counts once per sub-query, count distinct
answers. Returns
QueryFanoutData— nosourcedPrompts/trackedfieldsneeded for this display-only context.
web/src/app/[locale]/(dashboard)/dashboard/content/[id]/page.tsxgetPromptFanoutandFanoutSubQueryfromfanout.tsfanoutQueries: FanoutSubQuery[]state (default[])getOpportunity().then()block, load fan-out whenopp.brandIdandopp.promptIdare both present; errors caughtsilently so a missing fan-out never breaks the page load
the Keywords block — each chip shows the sub-query text and a
×{timesSearched}countfanoutQueriesis emptyAcceptance criteria
times-searched count when data exists
(same normalizeQuery + per-answer dedup + distinct answer count)
sits between existing Keywords and Competitors Cited blocks