Repository navigation
feat(web): pin the current user to the top of admin user list - #18345
Conversation
Admins most often act on their own account first, so surface it without scrolling or searching. Ordering the data rather than using row pinning keeps the row inside the existing search, filter, and pagination flow. Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe admin user list now places the authenticated user first when present. It preserves the order of other users and uses the reordered list as the table data source. ChangesAdmin user ordering
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized change is merge-ready after normal checks and review; no actionable merge-blocking risk remains. Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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. Comment |
wangq8
left a comment
There was a problem hiding this comment.
Thanks for this clean, well-scoped change. I reviewed the diff and cross-checked it against the current web/src/pages/admin/users.tsx.
What it does well
- Correctly guards the
usersList === undefinedcase by returningEMPTY_DATA, matching the previoususersList ?? EMPTY_DATAbehavior. findIndexreturning-1(current user not in the list) is handled correctly by thecurrentUserIndex <= 0branch, so there's no accidental pinning or duplication.- Pinning is done by reordering the data source, so the current user still participates in search, filtering, and pagination (total count is unchanged) — consistent with the PR description.
Suggestions (non-blocking)
- Sorting overrides the pin:
getSortedRowModelre-sorts the whole array, so once the user clicks a column header the current user moves back into their natural sorted position. Fine if the intent is "pin only in the default view", but worth confirming that's intentional. user.email === userInfo?.emailis case-sensitive. This is consistent with the existingisMechecks in this file, so no change needed — just flagging in case emails can ever differ in casing.- Minor style:
usersList.filter((_, index) => index !== currentUserIndex)works, but something like slice+concat would read slightly more clearly. Optional.
No regressions, style, or security concerns spotted. LGTM overall.
Summary
feat(web): pin the current user to the top of admin user list
Admins most often act on their own account first, so surface it without scrolling or searching. Ordering the data rather than using row pinning keeps the row inside the existing search, filter, and pagination flow.