fix(dashboard): source logs filter options from full value universe#3093
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🚀 Preview Environment (PR #3093)Preview URL: https://pr-3093.dev.getgram.ai
Gram Preview Bot |
What
Fixes AGE-2594. The server/user filter dropdowns on the Tool Logs and Insights → Tools pages got stuck whenever a filter returned no results, and only ever offered values that happened to be in the already-loaded rows.
Why
Both pages share
useObserveFilters, which builtserverOptions/userEmailOptionsfromknownServers/knownUserEmails— sets accumulated only from loaded result rows and reset on every date-range change. When a filter matched nothing, no new values were added, so the dropdown collapsed to just the currently-selected value. You could clear a filter but couldn't pivot to a different one.How
getHooksSummaryquery keyed only on the time range (no server/email/type filters), so it returns the full universe of servers and users for the window regardless of the filtered result set.serverOptionsfromservers[].serverNameanduserEmailOptionsfromusers[].userEmail, unioned with any currently-selected URL values.'local'/'Unknown'display sentinels — they never round-trip as real filter values (also removes a silently-broken'local'option Insights used to show).knownServers/knownUserEmailsstate, theaddKnown*callbacks, the reset effect, and four accumulationuseEffects. Net −24 lines.The query is keyed on
[from, to]only, so it's shared across both pages and across filter changes (one cache entry per time window), and the universe is now derived during render instead of synced via effects.Scope
Frontend-only — no backend, migration, or SDK changes.
Testing
tsc -p tsconfig.app.json --noEmit— clean on all changed files.eslint— clean on all changed files.Summary by cubic
Fixes AGE-2594: server and user filters on Tool Logs and Insights → Tools no longer get stuck when a filter returns no results. Dropdowns now show the full set of servers and users for the selected time range so you can pivot filters even with empty results.
[from, to]-keyeduseQueryusing@gram/client/funcs/telemetryGetHooksSummary(via@tanstack/react-query) to fetch the full universe of servers/users for the window, independent of active filters.serverOptionsfromservers[].serverNameanduserEmailOptionsfromusers[].userEmail, unioned with currently selected values; exclude the display-only sentinels "local" and "Unknown".knownServers/knownUserEmailsstate and related effects/callbacks, simplifying the hook and preventing option collapse on no-result filters.Written for commit cbfaab7. Summary will update on new commits.
Review in cubic