Repository navigation
fix(citations): count the Domains tab within the selected source scope - #1218
Merged
Merged
Conversation
The Domains tab showed every cited domain (totals.domains) whatever the scope, so the page, which opens on Brand, read Domains (754) over a table of the brand's own domains. The tab now counts the rows its table lists, so the full number shows on All only. The scope check the Domains and URLs rows each repeated is inSourceScope in lib/citations/scope.ts, with a test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Collaborator
Author
|
@gkhngyk A small fix: the Domains tab counted every cited domain whatever the scope, so the page, which opens on Brand, showed All's number (754) above the brand's own domains. The tab now counts the rows its table lists. The duplicated scope |
7 of 12 tasks
7 of 12 tasks
gkhngyk
approved these changes
Oct 20, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Checked on main: web tests pass. totals.domains was already rows.length, so All keeps the same number, and the other scopes now match their tables. A follow-up to scope the Unique Domains KPI the same way would be welcome.
7 of 12 tasks
gkhngyk
pushed a commit
that referenced
this pull request
Oct 20, 2026
…ce scope (#1249) The Unique Domains card counted every cited domain whatever the scope, while the unique URLs under it are counted within the scope (#745) and the Domains tab counts its rows (#1218). On Brand it could read 3 domains over 0 URLs. It now counts the domains in the selected scope, the same rows the Domains tab lists; All keeps its number. The page's first test pins it for Brand, Third party and All. Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
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
The Citations page's Domains tab now counts the domains in the selected source scope.
The bug. The tab label read
data.totals.domains, which counts every cited domain whatever the scope (Brand / Competitors / Third-Party / All). The page opens on Brand, so it read e.g. "Domains (754)" above a table listing only the brand's own domains. That number belongs to All.The fix.
filteredDomainRows, the rows its table lists. The domain list isn't capped, so this is the scope's full count, and All still shows the total.switchis nowinSourceScope(category, scope)inlib/citations/scope.ts, next toscopeDomainArgs, with a test.Related issue
None. A user report ("Domains shows 754 on open, which is All's number; it should only show on All").
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
/dashboard/citations. It opens on Brand, and the Domains count equals the rows in its table.I checked this locally with temporary citations (since deleted):
The table rows matched each count, in light and dark themes.
scope.test.tscoversinSourceScopefor every scope.Not in this PR: the Unique Domains KPI counts every domain, while its "N unique URLs" line follows the scope. It could read "5 domains · 2 URLs" on Brand. I can follow up if you want them consistent.
Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Also run:
yarn test(1,695 pass) andyarn build(with the CI placeholders).🤖 Generated with Claude Code