Skip to content

Conversation

@mktwix
Copy link

@mktwix mktwix commented Dec 25, 2025

The email column in User Management was using accessorKey which gets converted to accessorFn in PgTable.jsx. This caused a closure bug where all columns captured the same accessorKey value, resulting in all users displaying the logged-in user's email address.

Fix by explicitly using accessorFn to avoid the closure issue.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of missing email addresses in the Users list to display correctly when email data is unavailable.

✏️ Tip: You can customize this high-level summary in your review settings.

The email column in User Management was using accessorKey which gets
converted to accessorFn in PgTable.jsx. This caused a closure bug where
all columns captured the same accessorKey value, resulting in all users
displaying the logged-in user's email address.

Fix by explicitly using accessorFn to avoid the closure issue.
@coderabbitai
Copy link

coderabbitai bot commented Dec 25, 2025

Walkthrough

The Email column accessor in the Users component was modified to retrieve values via a function instead of a direct property reference, with null-safety handling to ensure empty strings are returned when email is absent.

Changes

Cohort / File(s) Summary
Email Column Accessor Update
web/pgadmin/tools/user_management/static/js/Users.jsx
Changed Email column from accessorKey: 'email' to accessorFn: (row) => row.email ?? '' to add null/undefined safety with fallback to empty string

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and concisely identifies the main fix: addressing a closure bug in the User Management email column display.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a5e9315 and b62632a.

📒 Files selected for processing (1)
  • web/pgadmin/tools/user_management/static/js/Users.jsx
🔇 Additional comments (2)
web/pgadmin/tools/user_management/static/js/Users.jsx (2)

211-211: LGTM! The closure bug fix is correct.

The conversion from accessorKey to accessorFn with explicit row parameter correctly fixes the closure bug described in the PR. The nullish coalescing operator (??) appropriately handles null/undefined email values.


202-202: Verify that other accessorKey columns work correctly.

Since the PR description indicates the closure bug originated from PgTable.jsx's conversion of accessorKey to accessorFn, please verify that the Username, Active, and Locked columns (which still use accessorKey) display the correct values for each user row and don't exhibit similar issues.

If these columns also experience the closure bug, consider converting them to accessorFn following the same pattern used for the Email column:

// Example for Username column
accessorFn: (row) => row.username ?? '',

// Example for Active column  
accessorFn: (row) => row.active,

// Example for Locked column
accessorFn: (row) => row.locked,

Alternatively, if the root cause is in PgTable.jsx's conversion logic, fixing it there would prevent similar issues in the future.

Also applies to: 229-229, 239-239


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@khushboovashi
Copy link
Contributor

Hi @mktwix, can you please provide a screenshot of the mentioned bug in this PR?

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.

2 participants