Repository navigation
chore(citations): trim Competitor Gaps query + decouple its refetch from domain-list flags - #327
Merged
Merged
Conversation
…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.
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
Follow-up to #326 addressing the two Copilot review comments (the PR was already merged, so this is a separate small PR):
getCitationGapsselectedmodel_used,region,created_atbut never reads them from the returned rows — they're only used in theWHEREclause (date/region/model filters), which is independent of theselect. Narrowed toid, citations, competitor_mentions, mention_countto keep the lazy-loaded tab lean.apiFilters, which includes the Exclude own domain / Competitors only / Own domain only flags. Those are domain-list filters thatgetCitationGapsdoesn't apply, so toggling them while on the Gaps tab triggered a no-op refetch. Split out agapFiltersmemo (date / platform / region / topic / prompt only) andapiFiltersnow builds on top of it; the gaps effect keys offgapFilters.No behavior change to results — purely less wasted payload/refetch.
Type of change
chore— MaintenanceHow to test
Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)