fix: user table to load on scroll#29593
Conversation
|
Welcome to Cal.diy, @ChayanDass! Thanks for opening this pull request. A few things to keep in mind:
A maintainer will review your PR soon. Thanks for contributing! |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughIn 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/web/modules/users/components/UsersTable.tsx (1)
127-127: ⚡ Quick winPass the scroll event’s current target directly to the fetch callback.
At Line 127, use
e.currentTargetinstead oftableContainerRef.currentso the infinite-scroll check always evaluates the element that actually fired the scroll event.Suggested diff
- onScroll={() => fetchMoreOnBottomReached(tableContainerRef.current)} + onScroll={(e) => fetchMoreOnBottomReached(e.currentTarget)}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/modules/users/components/UsersTable.tsx` at line 127, In the onScroll event handler callback for the table container, replace the argument passed to fetchMoreOnBottomReached from tableContainerRef.current to e.currentTarget. This ensures the infinite-scroll check evaluates the actual element that fired the scroll event rather than a potentially stale ref value. Update the onScroll arrow function to accept the scroll event parameter and pass e.currentTarget to the fetchMoreOnBottomReached function.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@apps/web/modules/users/components/UsersTable.tsx`:
- Line 127: In the onScroll event handler callback for the table container,
replace the argument passed to fetchMoreOnBottomReached from
tableContainerRef.current to e.currentTarget. This ensures the infinite-scroll
check evaluates the actual element that fired the scroll event rather than a
potentially stale ref value. Update the onScroll arrow function to accept the
scroll event parameter and pass e.currentTarget to the fetchMoreOnBottomReached
function.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e581dfa5-ef86-49ae-9ada-3234d43924fa
📒 Files selected for processing (1)
apps/web/modules/users/components/UsersTable.tsx
c2e24a4 to
58a655e
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/trpc/server/routers/viewer/admin/listPaginated.handler.ts (1)
17-17: ⚡ Quick winRemove stale commented-out query code.
This dead line is no longer needed after the transaction refactor and adds noise during maintenance.
As per coding guidelines, “Only add code comments that explain why, not what” and avoid non-actionable/commented-out code.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/trpc/server/routers/viewer/admin/listPaginated.handler.ts` at line 17, Remove the commented-out line containing the getTotalUsers query in listPaginated.handler.ts. The line `// const getTotalUsers = await prisma.user.count();` is stale code from before the transaction refactor and adds unnecessary noise to the file. Delete this entire commented line as it violates the coding guideline of not including commented-out or dead code in the codebase.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/trpc/server/routers/viewer/admin/listPaginated.handler.ts`:
- Line 17: Remove the commented-out line containing the getTotalUsers query in
listPaginated.handler.ts. The line `// const getTotalUsers = await
prisma.user.count();` is stale code from before the transaction refactor and
adds unnecessary noise to the file. Delete this entire commented line as it
violates the coding guideline of not including commented-out or dead code in the
codebase.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 029e3e5c-ce3d-4931-a4b2-ea1103dc69f0
📒 Files selected for processing (1)
packages/trpc/server/routers/viewer/admin/listPaginated.handler.ts
150838e to
fa9d59c
Compare
bandhan-majumder
left a comment
There was a problem hiding this comment.
nice catch. left some comments!
Signed-off-by: Chayan Das <daschayan8837@gmail.com>
Add a dedicated listUsers method with search and cursor pagination support. Add repository tests covering filtering and pagination. Ensure user listing metadata remains consistent with the returned results. Signed-off-by: Chayan Das <daschayan8837@gmail.com>
fa9d59c to
9f1e10e
Compare


What does this PR do?
Improves the Users table experience by adding a user count indicator and refining infinite scroll behavior.
Changes
Display the number of loaded users out of the total available users (
Showing X of Y).Show a loading message while the initial user list is being fetched.
Pass the table container reference to
fetchMoreOnBottomReachedwhen handling scroll events.Improve layout spacing between the search input and the users table.
Fixes scroll doesn't load more users, no loaded count indicator, missing spacing #29590
Visual Demo (For contributors especially)
Before:
After:
Screencast.from.2026-06-17.11-25-03.webm
Showing X of Yusers.Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Showing X of Yappears after users are loaded.Expected Result
Checklist