Skip to content

fix(platform): show conversation status-tab count badges, drop dead ?priority= param - #2226

Merged
yannickmonney merged 1 commit into
mainfrom
tale/xs7afk3471v4jbjdp93njz16eh89fn7r
Jun 29, 2026
Merged

yannickmonney merged 1 commit into
mainfrom
tale/xs7afk3471v4jbjdp93njz16eh89fn7r

Conversation

@larryro

@larryro larryro commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Two small conversations-inbox refinements from #1982:

  1. Status-tab count badges now render. The per-status approximate counts were already prefetched on the conversations route loader but never displayed (the prefetch was load-bearing only). ConversationsNavigation now subscribes to those same counts and renders each as a trailing badge on its status tab (open / closed / spam / archived), shown only when the count is > 0 and capped as 20+ (matching the backend DEFAULT_COUNT_CAP). Because the badge query shares the subscription primed by the route loader's prefetch, the badges paint without a refetch on first nav.
  2. Dead ?priority= route param removed. The conversations status route accepted a ?priority= search param, but no UI ever set or cleared it. Removed it from the route's search schema and its plumbing into useListConversationsPaginated. (The backend query still supports priority filtering via the hook should a UI control be added later.)

Testing

  • tsc --noEmit — clean
  • oxlint --type-aware on changed files — 0 warnings / 0 errors
  • UI tests: app/features/conversations — 7 files / 32 tests pass (includes the navigation a11y/axe test, updated to stub the new count query)

Closes #1982

…priority= param

Render the per-status approximate counts (already prefetched on the conversations route) as a trailing badge on each status tab, and remove the unused ?priority= search param from the conversations status route since no UI sets or clears it.

Closes #1982
@larryro

larryro commented Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

Desk review — #1982 (status-tab count badges + dead ?priority= param)

Verdict: READY TO MERGE.

Reviewed the full implementation on branch tale/xs7afk3471v4jbjdp93njz16eh89fn7r (not just the diff), across correctness, robustness, elegance, tests, and boundaries, with an independent confirmation pass on every point I'd block on.

CI & tests

  • CI: green. All required checks pass (Type check, Lint, Format, Knip, Unit, UI, Storybook, Build platform/convex, Migrations, all 16 Playwright platform shards, Playwright web/docs, Opengrep, Trivy, Scan platform, Smoke). The only non-pass rows are fork-PR / docs-container / web-container jobs marked skipping by design — no failures, nothing pending.
  • Tests run locally: bunx vitest --run --config vitest.ui.config.ts app/features/conversations → 7 files / 32 tests passed.

What I verified

  • Badges wired to the prefetched data (part 1). ConversationsNavigation subscribes via useApproxConversationCountByStatus (useConvexQuery → convexQuery(api.conversations.queries.approxCountConversationsByStatus, {organizationId, status})), the same query+args the parent route loader (conversations.tsx) prefetches — identical react-query key, so badges paint from the primed cache without a refetch. The prefetch is no longer "load-bearing only".
  • Cap boundary correct. Backend approxCountConversationsByStatus breaks at count >= DEFAULT_COUNT_CAP (20), so it returns at most 20; CountBadge renders 20+ at >= 20. Semantics match an approximate "at least N" count.
  • Zero/undefined handling correct. Badge renders only when count !== undefined && count > 0 — no 0 badge, no flash of undefined/NaN while loading or on query error (graceful degradation).
  • ?priority= fully removed from the route (part 2). Dropped from searchSchema, from Route.useSearch() destructuring, and from the useListConversationsPaginated call in $status.tsx. Old bookmarked ?priority=… URLs degrade safely — zod strips unknown keys rather than throwing.
  • No new subscription leak. $status.tsx already subscribed to the same 4 counts (pre-existing); the nav's 4 calls dedupe to the same cache keys.
  • Boundaries. Count query is queryWithRLS (org-scoped, no cross-org leakage) and status is constrained to the 4 literals; both parts of the issue are genuinely resolved.

Non-blocking notes (optional cleanup — do not block merge)

  1. ListConversationsPaginatedArgs.priority?: string (app/features/conversations/hooks/queries.ts:26) now has no frontend caller. Leaving it is defensible (backend still supports priority filtering and the PR documents this as intentional for a future UI control); removing it would be marginally cleaner.
  2. The added test (conversations-navigation.test.tsx) is a11y-only and does not assert badge value / 20+ cap / hide-on-zero. This matches the repo's own convention for sibling display components (conversation-list-toolbar, activate-conversations-empty-state, dot-icon are all a11y-only), so it is not a blocker — but a couple of behavioral assertions on the badge branches would be a nice-to-have.

READY TO MERGE.

@yannickmonney
yannickmonney merged commit d048273 into main Jun 29, 2026
51 checks passed
@yannickmonney
yannickmonney deleted the tale/xs7afk3471v4jbjdp93njz16eh89fn7r branch June 29, 2026 17:21
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.

Improvement: Conversations — status-tab count badges are prefetched but never displayed; dead ?priority= route param

2 participants