Skip to content

chore(citations): trim Competitor Gaps query + decouple its refetch from domain-list flags - #327

Merged
gkhngyk merged 1 commit into
mainfrom
chore/citation-gaps-followup
Jul 2, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
chore/citation-gaps-followup

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #326 addressing the two Copilot review comments (the PR was already merged, so this is a separate small PR):

  1. Trim the gaps query select. getCitationGaps selected model_used, region, created_at but never reads them from the returned rows — they're only used in the WHERE clause (date/region/model filters), which is independent of the select. Narrowed to id, citations, competitor_mentions, mention_count to keep the lazy-loaded tab lean.
  2. Decouple the Gaps refetch from domain-list flags. The Gaps tab fetch was keyed off apiFilters, which includes the Exclude own domain / Competitors only / Own domain only flags. Those are domain-list filters that getCitationGaps doesn't apply, so toggling them while on the Gaps tab triggered a no-op refetch. Split out a gapFilters memo (date / platform / region / topic / prompt only) and apiFilters now builds on top of it; the gaps effect keys off gapFilters.

No behavior change to results — purely less wasted payload/refetch.

Type of change

  • chore — Maintenance

How to test

  1. Citations → Competitor Gaps works exactly as before (same gap list / by-competitor results).
  2. On the Gaps tab, toggling Exclude own domain / Competitors only / Own domain only no longer refetches gaps; changing date / platform / region / topic / prompt does.
  3. The Domains / URLs tabs still apply those flags as before.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

…rom domain-list flags

Follow-up to #326 (Copilot review):
- getCitationGaps selected model_used / region / created_at but never read
  them from the rows (they're only used in the WHERE clause). Trim the
  select to id, citations, competitor_mentions, mention_count.
- The Gaps tab fetch was keyed off apiFilters, which includes the
  exclude-own / competitor-only / own-only domain-list flags that
  getCitationGaps doesn't apply — so toggling them triggered a no-op
  refetch. Split out a gapFilters memo (date/platform/region/topic/prompt
  only) and key the gaps effect off it.
@gkhngyk
gkhngyk requested a review from Copilot July 1, 2026 11:13
@gkhngyk
gkhngyk merged commit 1b3f746 into main Jul 2, 2026
5 checks passed
@gkhngyk gkhngyk mentioned this pull request Jul 6, 2026
5 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant