Repository navigation
fix(admin): fetch user subdomains server-side, not from truncated DnsRecord.list() - #59
Merged
Merged
Conversation
…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
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.
Fixes #58
Changes
AdminUsers.jsxDnsRecord.list()(default limit 1,000) withSubdomainOwnership.list(null, 10000)for the table subdomain count column. SubdomainOwnership is the canonical one-per-subdomain entity and gives the correct count.useEffectthat fires onselectedUser?.emailchange and fetchesDnsRecord.filter({ owner_email, managed: true }, null, 10000)on demand, storing the result inselectedUserSubdomainsstate. Only fetches when a user is actually opened — no unnecessary bulk load.dnsRecordsstate andgetUserSubdomainshelper.UserDetailModal.jsxsubdomainsLoadingprop and renders a loading state while the per-user fetch is in flight.Why this approach
Bumping the list call to
limit=10000on 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.