Skip to content

Citations: replace the three interlinked category toggle buttons with a single source-scope selector #655

Closed

Description

@gkhngyk

Problem

The Citations filter bar has three separate toggle buttons for source category — Exclude own domain, Competitors only, and Own domain only — that actually represent one mutually-exclusive choice. They keep each other consistent through hand-wired onChange logic: turning on Competitors only silently also enables Exclude own domain, each button clears the others, and so on. The result reads as overlapping/redundant controls ("Exclude own domain" and "Competitors only" look like the same thing), and the toggle-button widget suggests the options are freely combinable when they aren't.

The wording is also narrower than what the page shows: cited sources aren't only domains.

Evidence

Proposal

Replace the three buttons with a single Sources selector (segmented control or Select, matching the other filter-bar controls) with four options:

Option Behavior (today's equivalent)
All sources no category filter (default)
Third-party only hide the brand's own sources — competitors and neutral sources stay (today's Exclude own domain)
Competitor sources only competitor sources (today's Competitors only)
Own sources only the brand's own sources (today's Own domain only)

Model it as one field, e.g. sourceScope: 'all' | 'third_party' | 'competitors' | 'own', replacing the excludeOwnDomain / competitorOnly / ownOnly booleans in the filter state, the server action's filter params, and everywhere the page threads them through. The hand-wired mutual-exclusion logic disappears entirely — inconsistent combinations become unrepresentable.

Acceptance criteria

  • One selector labeled Sources with the four options above; the three toggle buttons are gone.
  • Each option filters exactly as its old counterpart did (Third-party only must keep neutral sources visible — it is not the same as Competitor sources).
  • Filter state carries a single scope value; the excludeOwnDomain/competitorOnly/ownOnly booleans and their cross-toggle wiring are removed end to end (filter bar, page, server action).
  • Reset/clear-filters returns the selector to All sources.

Activity

  1. added
    enhancement
    good first issue
    on Aug 7, 2026
  2. BharadwajKanneveti commented on Aug 7, 2026

    @BharadwajKanneveti
    Contributor

    Hi @gkhngyk I will work on this issue.

  3. gkhngyk commented on Aug 10, 2026

    @gkhngyk
    ContributorAuthor

    @BharadwajKanneveti assigned — thanks for taking it.

    Three things worth knowing before you start:

    Keep "Third-party only" distinct from "Competitor sources." This is the easiest part to get wrong: today's Exclude own domain keeps neutral third-party sources (news sites, blogs, wikis) visible alongside competitors, while Competitors only hides them. They look redundant precisely because turning on the second silently turns on the first (filter-bar.tsx#L386) — but they are genuinely different views, and collapsing them into one would lose the "who else gets cited in my space" answer.

    #657 pairs with this one. It moves scope filtering to the client, since the rows already carry a category and re-scanning the window server-side buys nothing. If you do both together you avoid wiring the new selector through the server round-trip only to unwire it afterwards. Entirely your call whether to combine them or land this first.

    Heads-up on overlap: #656 is assigned to @tomatotomata and touches citations/page.tsx (the refetch/loading state), which is also where the filter state lives that you'll be replacing. Whoever lands second will need a small rebase — nothing structural, just worth knowing it's coming.

  4. added
    citations
    on Aug 12, 2026
  5. gkhngyk commented on Aug 12, 2026

    @gkhngyk
    ContributorAuthor

    @BharadwajKanneveti — checking in on this one. Still interested, or would you rather it went back to the pool? Either answer is fine; no pressure after the work you put into #662.

    If you are picking it up, the open question from my earlier comment still stands: do you want to fold #657 into the same PR? The two fit together — #655 introduces the sourceScope selector, #657 decides what it is wired to, namely filtering on the client instead of refetching the window. Doing them in one PR avoids wiring the selector through a server round-trip only to unwire it immediately after. Happy either way, it just changes which one closes.

    One heads-up if you do start: citations/page.tsx has moved since this issue was written — #684 and #696 both landed on it — so expect a rebase.

  6. BharadwajKanneveti commented on Aug 12, 2026

    @BharadwajKanneveti
    Contributor

    @gkhngyk Sure assign it to me i will work on both on them and raise a single pr for it

  7. gkhngyk commented on Aug 13, 2026

    @gkhngyk
    ContributorAuthor

    Sounds good — one PR for both.

    GitHub won't let me assign you on #657 yet: it only accepts assignees who have participated in that issue. Drop any comment there and I'll assign it straight away.

    Put both lines in the PR description so the pair closes together:

    Closes #655
    Closes #657
    

    The open question from earlier still needs an answer in the design, and it's the one thing worth settling before you write code: "Third-party only" and "Competitor sources" are different views, not redundant ones. Today's Exclude own domain keeps neutral third-party sources — news sites, blogs, wikis — visible alongside competitors, while Competitors only hides them. They look redundant because turning on the second silently turns on the first, but collapsing them into a single option loses the "who else gets cited in my space" answer. So the new selector needs at least: all sources, third-party (own domain excluded, competitors and neutrals kept), competitors only, own domain only.

    One practical note: if it's easier, open the PR as a draft early. Reviewing the selector shape before the client-side filtering is wired on top is cheaper for both of us than finding a disagreement at the end.

    And a heads-up on rebasing — citations/page.tsx and lib/actions/citations.ts have both moved since these issues were written (#684, #696 and #707 all landed on them), so start from current main.

  8. gkhngyk commented on Aug 14, 2026

    @gkhngyk
    ContributorAuthor

    Design decision for the selector, so this is settled before the code:

    Four options, as a strict partition: All · Brand · Competitors · Third-party.

    classifyDomain already returns eight categories — you, competitor, editorial, review, forum, institutional, social, other — so the mapping is:

    option categories
    All everything
    Brand you
    Competitors competitor
    Third-party the remaining six

    Every citation lands in exactly one bucket, which is what a single-select control needs. Today's three toggles overlap — turning on Competitors only silently turns on Exclude own domain — and that overlap is the reason they read as redundant.

    Call the fourth option "Third-party", not "Other". Two reasons, one of them concrete: the per-row badges on that same table already say Other, Social, Forum, Competitor, where Other is the narrow eighth category. A filter button labelled "Other" would mean six categories while the badge two rows below means one. Beyond the collision, that bucket holds editorial, review, forum and institutional sources — the places AEO work actually targets. Naming it "Other" tells the customer it is a leftovers bin when it is the most actionable view on the page.

    One thing to decide alongside it: does the scope still change the KPI cards?

    It does today — citations.ts#L295-L299 applies the category filters before totalCitations += 1, so Total Citations, Unique Domains and Avg Citations per Result all move with the scope. If the selector sits inside the Top Sources card, below those cards, the numbers above will change with no visible cause. Either:

    • keep it scoping everything and put it in the filter bar with Date Range / Topic / Prompt / Platform / Region, or
    • scope only the tables in that card, and leave the KPIs describing the whole window.

    The second reads better to me — the KPIs answer "how much am I cited overall", the tables answer "by whom" — but it is a behaviour change from today, so it should be deliberate rather than a side effect of where the buttons landed.

    What is lost: today's Exclude own domain shows competitors and third-party together, and a strict partition cannot express that in one click. I think that is fine — they answer different questions. Competitors are information ("who is winning"), third-party is action ("where can I get cited"). Splitting them is an improvement, not a regression.

    Once the selector exists, #657 is the other half: filter by scope on the client rather than refetching the window, since every row already carries its category.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

citationsenhancementgood first issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions