Skip to content

fix(admin): fetch user subdomains server-side, not from truncated DnsRecord.list() - #59

Merged
andrewstech merged 1 commit into
mainfrom
fix/admin-users-subdomain-limit
Oct 25, 2026
Merged

andrewstech merged 1 commit into
mainfrom
fix/admin-users-subdomain-limit

Conversation

@christopher-od

@christopher-od christopher-od Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #58

Changes

AdminUsers.jsx

  • Replaces DnsRecord.list() (default limit 1,000) with SubdomainOwnership.list(null, 10000) for the table subdomain count column. SubdomainOwnership is the canonical one-per-subdomain entity and gives the correct count.
  • Adds a useEffect that fires on selectedUser?.email change and fetches DnsRecord.filter({ owner_email, managed: true }, null, 10000) on demand, storing the result in selectedUserSubdomains state. Only fetches when a user is actually opened — no unnecessary bulk load.
  • Removes the now-unused dnsRecords state and getUserSubdomains helper.

UserDetailModal.jsx

  • Accepts new subdomainsLoading prop and renders a loading state while the per-user fetch is in flight.

Why this approach

Bumping the list call to limit=10000 on DnsRecords would paper over the problem until the system grows further. Fetching per-user on demand is the correct fix: it's always accurate, only runs when needed, and avoids loading thousands of records the page doesn't use.

…Record.list()

The Admin Users page was calling DnsRecord.list() at load time (no limit
parameter), which hits the entity-routes default cap of 1,000 records.
With 3,235+ DnsRecords in the system, users whose records fell outside
the oldest-1,000 window showed 'Subdomains (0)' in the detail modal.

Changes:
- Replace DnsRecord.list() in load() with SubdomainOwnership.list(null, 10000)
  for the table count column; SubdomainOwnership is the canonical per-subdomain
  entity and correctly counts owned subdomains rather than individual DNS records.
- Add a useEffect that fetches DnsRecord.filter({ owner_email, managed: true },
  null, 10000) on demand when a user is selected in the detail modal, so the
  full record list is always accurate and the fetch only happens when needed.
- Pass subdomainsLoading prop to UserDetailModal to show a loading state
  while the per-user fetch is in flight.

Fixes #58
@andrewstech
andrewstech merged commit 235f2d6 into main Oct 25, 2026
1 of 2 checks passed
@andrewstech
andrewstech deleted the fix/admin-users-subdomain-limit branch October 25, 2026 19:35
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.

Admin Users panel: subdomain count truncated at 1,000 DnsRecords

1 participant