fix: add missing error state to ModerationConsoleTable and CustomUserStatusTable#39643
Conversation
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
🦋 Changeset detectedLatest commit: c62fe28 The changes in this PR will be included in the next version bump. This PR includes changesets to release 41 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📜 Recent review details🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx,js}📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
Files:
🧠 Learnings (3)📚 Learning: 2026-03-04T14:16:49.202ZApplied to files:
📚 Learning: 2025-12-02T22:23:49.593ZApplied to files:
📚 Learning: 2026-02-25T20:10:16.987ZApplied to files:
🔇 Additional comments (3)
WalkthroughAdds missing error-state handling to two admin table components so they render a consistent error UI with a reload action when their data queries fail; also adds a changeset entry documenting the patch. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📝 Coding Plan
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.
1 issue found across 3 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/meteor/client/views/admin/customUserStatus/CustomUserStatusTable/CustomUserStatusTable.tsx">
<violation number="1" location="apps/meteor/client/views/admin/customUserStatus/CustomUserStatusTable/CustomUserStatusTable.tsx:65">
P2: Unconditional `isError` return hides previously loaded table data on refetch failures; gate the error UI to initial-load/no-data failures.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
…StatusTable Resolves RocketChat#39521. Both tables silently showed an empty state when the API request failed. Added error state with warning icon, error message, and reload button following the pattern established in CustomSoundsTable. For CustomUserStatusTable, the error state is gated on !data to preserve previously loaded table data on refetch failures. Made-with: Cursor
3a10ec0 to
b982d4a
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/meteor/client/views/admin/customUserStatus/CustomUserStatusTable/CustomUserStatusTable.tsx (1)
65-75: Consider extracting thisStateserror block into a shared admin-table fallback component.This same warning/retry JSX now exists in multiple admin tables, so a small shared component would reduce duplication and prevent drift.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/meteor/client/views/admin/customUserStatus/CustomUserStatusTable/CustomUserStatusTable.tsx` around lines 65 - 75, Extract the duplicated error UI into a shared component (e.g., AdminTableFallback or AdminTableErrorState) and replace the inline block in CustomUserStatusTable with that component; the new component should render the same JSX (States, StatesIcon name='warning' variation='danger', StatesTitle using the t('Something_went_wrong') key, and a retry StatesAction) and accept props for onRetry (pass refetch), and optionally a message key or children for custom text; update CustomUserStatusTable to import and render <AdminTableFallback onRetry={refetch} /> where the current isError && !data block appears.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@apps/meteor/client/views/admin/customUserStatus/CustomUserStatusTable/CustomUserStatusTable.tsx`:
- Around line 65-75: Extract the duplicated error UI into a shared component
(e.g., AdminTableFallback or AdminTableErrorState) and replace the inline block
in CustomUserStatusTable with that component; the new component should render
the same JSX (States, StatesIcon name='warning' variation='danger', StatesTitle
using the t('Something_went_wrong') key, and a retry StatesAction) and accept
props for onRetry (pass refetch), and optionally a message key or children for
custom text; update CustomUserStatusTable to import and render
<AdminTableFallback onRetry={refetch} /> where the current isError && !data
block appears.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: aab79f82-c41d-4a76-a5dd-c6d2f44f2f90
📒 Files selected for processing (3)
.changeset/fix-missing-error-state-tables.mdapps/meteor/client/views/admin/customUserStatus/CustomUserStatusTable/CustomUserStatusTable.tsxapps/meteor/client/views/admin/moderation/ModerationConsoleTable.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- .changeset/fix-missing-error-state-tables.md
📜 Review details
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
apps/meteor/client/views/admin/customUserStatus/CustomUserStatusTable/CustomUserStatusTable.tsxapps/meteor/client/views/admin/moderation/ModerationConsoleTable.tsx
🧠 Learnings (1)
📚 Learning: 2025-12-02T22:23:49.593Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 37654
File: apps/meteor/client/hooks/useAppSlashCommands.ts:32-38
Timestamp: 2025-12-02T22:23:49.593Z
Learning: In apps/meteor/client/hooks/useAppSlashCommands.ts, the `data?.forEach((command) => slashCommands.add(command))` call during render is intentional. The query is configured with `structuralSharing: false` to prevent React Query from keeping stable data references, and `slashCommands.add` is idempotent, so executing on every render is acceptable and ensures the command registry stays current.
Applied to files:
apps/meteor/client/views/admin/customUserStatus/CustomUserStatusTable/CustomUserStatusTable.tsxapps/meteor/client/views/admin/moderation/ModerationConsoleTable.tsx
🔇 Additional comments (2)
apps/meteor/client/views/admin/moderation/ModerationConsoleTable.tsx (1)
2-2: Error-state handling is correctly integrated and retryable.This update cleanly adds explicit failure UI and a retry path, preventing the previous silent blank state while keeping the existing loading/success flows intact.
Also applies to: 56-63, 137-145
apps/meteor/client/views/admin/customUserStatus/CustomUserStatusTable/CustomUserStatusTable.tsx (1)
1-1: The new error path is correct and user-visible on fetch failure.
isErrorhandling plus the retry action resolves the missing error state without disrupting the existing data flow.Also applies to: 49-59, 65-75
When using keepPreviousData, a refetch failure would previously hide the cached table data behind the error UI. Now the error state only renders when no data is available, preserving the user experience on transient refetch failures. Made-with: Cursor
|
Thanks for the review! I've addressed the feedback: the |
Proposed changes (including videos or screenshots)
Adds the missing error state to
ModerationConsoleTableandCustomUserStatusTable. Both tables previously showed a silent blank/empty state when the API request failed, making it impossible for users to distinguish between a genuine empty result and a failed request.Changes:
apps/meteor/client/views/admin/moderation/ModerationConsoleTable.tsx:isErrorandrefetchto query destructuring// TODO: Missing error statecommentapps/meteor/client/views/admin/customUserStatus/CustomUserStatusTable/CustomUserStatusTable.tsx:isErrorto query destructuring!datanull return (early return pattern)// TODO: Missing error statecommentPattern followed
Both implementations follow the existing error state pattern in
CustomSoundsTable.tsx:Issue(s)
Closes #39521
Steps to test or reproduce
Made with Cursor
Summary by CodeRabbit
Bug Fixes
Chores