Skip to content

Conversation

benjaminshafii
Copy link
Member

Summary

Add user details dialog to admin panel for easier debugging

Changes

  • Add getUserDetails tRPC procedure that fetches user info, workspace details, and features
  • Display savings enabled status (Yes/No with color coding)
  • Show primary workspace name and all workspace memberships
  • Include user role, feature list with purchase source, and account status

Info Displayed

  • Savings Enabled: Yes/No with color indicator
  • Workspace Name: Primary workspace name and ID
  • User Role: startup/contractor
  • Features: All active features with activation details
  • Debug Info: KYC status, Align IDs, sync status, creation date

Copy link

vercel bot commented Oct 3, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
zerofinance Ready Ready Preview Comment Oct 3, 2025 11:12pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
zero-finance-weloveyourstartup Ignored Ignored Preview Oct 3, 2025 11:12pm

@vercel vercel bot temporarily deployed to Preview – zerofinance October 3, 2025 22:22 Inactive
Comment on lines +69 to +82
const {
data: userDetails,
isLoading: isLoadingDetails,
refetch: refetchUserDetails,
} = api.admin.getUserDetails.useQuery(
{
adminToken,
privyDid: selectedUser?.privyDid || '',
},
{
enabled: !!selectedUser && isUserDetailsOpen && isTokenValid,
retry: false,
},
);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The user details dialog doesn't handle error states from the tRPC query, potentially showing "No details available" for both failed requests and legitimately empty data.

View Details
📝 Patch Details
diff --git a/packages/web/src/app/(public)/admin/page.tsx b/packages/web/src/app/(public)/admin/page.tsx
index 81411614..9148031d 100644
--- a/packages/web/src/app/(public)/admin/page.tsx
+++ b/packages/web/src/app/(public)/admin/page.tsx
@@ -69,6 +69,7 @@ export default function AdminPage() {
   const {
     data: userDetails,
     isLoading: isLoadingDetails,
+    error: userDetailsError,
     refetch: refetchUserDetails,
   } = api.admin.getUserDetails.useQuery(
     {
@@ -221,6 +222,10 @@ export default function AdminPage() {
 
           {isLoadingDetails ? (
             <div className="py-8 text-center">Loading user details...</div>
+          ) : userDetailsError ? (
+            <div className="py-8 text-center text-red-600">
+              Error loading user details: {userDetailsError.message}
+            </div>
           ) : userDetails ? (
             <div className="space-y-6">
               <Card>

Analysis

Admin panel user details dialog lacks error handling for failed tRPC queries

What fails: api.admin.getUserDetails.useQuery() in admin page doesn't extract or handle error state, causing all failure scenarios to show generic "No details available" message

How to reproduce:

  1. Open admin panel and click on a user to view details
  2. Trigger any error condition (invalid admin token, network failure, server error)
  3. Dialog shows "No details available" instead of specific error message

Result: All error conditions (network failures, authorization errors, server errors) are indistinguishable from legitimate empty data cases

Expected: Show specific error messages when tRPC queries fail per TanStack Query error handling docs - useQuery returns error property for failed requests

Root cause: Query hook only destructures data, isLoading, refetch but omits error property. Conditional rendering only checks loading and data states.

- Add getUserDetails tRPC procedure to fetch user info, workspace, and features
- Show savings enabled status with color indicator
- Display primary workspace name and memberships
- Include user role, features list, and account status
@benjaminshafii benjaminshafii force-pushed the feat/admin-user-details branch from 69d6f6c to 6b69cd7 Compare October 3, 2025 23:08
@benjaminshafii benjaminshafii merged commit eedfad6 into main Oct 3, 2025
6 checks passed
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.

1 participant