Skip to content

fix: add missing error state to ModerationConsoleTable and CustomUserStatusTable#39643

Open
Avanish-Gupta-CSE wants to merge 2 commits into
RocketChat:developfrom
Avanish-Gupta-CSE:fix/issue-39521-missing-error-state-tables
Open

fix: add missing error state to ModerationConsoleTable and CustomUserStatusTable#39643
Avanish-Gupta-CSE wants to merge 2 commits into
RocketChat:developfrom
Avanish-Gupta-CSE:fix/issue-39521-missing-error-state-tables

Conversation

@Avanish-Gupta-CSE
Copy link
Copy Markdown

@Avanish-Gupta-CSE Avanish-Gupta-CSE commented Mar 15, 2026

Proposed changes (including videos or screenshots)

Adds the missing error state to ModerationConsoleTable and CustomUserStatusTable. 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:

  1. apps/meteor/client/views/admin/moderation/ModerationConsoleTable.tsx:

    • Added isError and refetch to query destructuring
    • Added error state block with warning icon, "Something went wrong" message, and "Reload page" button
    • Removed // TODO: Missing error state comment
  2. apps/meteor/client/views/admin/customUserStatus/CustomUserStatusTable/CustomUserStatusTable.tsx:

    • Added isError to query destructuring
    • Added error state block before the !data null return (early return pattern)
    • Removed // TODO: Missing error state comment

Pattern followed

Both implementations follow the existing error state pattern in CustomSoundsTable.tsx:

{isError && (
  <States>
    <StatesIcon name='warning' variation='danger' />
    <StatesTitle>{t('Something_went_wrong')}</StatesTitle>
    <StatesActions>
      <StatesAction onClick={() => refetch()}>{t('Reload_page')}</StatesAction>
    </StatesActions>
  </States>
)}

Issue(s)

Closes #39521

Steps to test or reproduce

  1. Go to Admin > Moderation (or Admin > Custom User Status)
  2. Simulate a network failure or API error
  3. Before: Table shows blank state indistinguishable from empty data
  4. After: Error state displays with warning icon, error message, and reload button

Made with Cursor

Summary by CodeRabbit

  • Bug Fixes

    • Restored missing error states in moderation and custom user status tables; displays a clear error message and a reload action when data fetching fails.
  • Chores

    • Added changeset metadata for a patch release that includes the error-state restoration.

@Avanish-Gupta-CSE Avanish-Gupta-CSE requested a review from a team as a code owner March 15, 2026 05:15
@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot Bot commented Mar 15, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 15, 2026

🦋 Changeset detected

Latest commit: c62fe28

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 41 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/http-router Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/ui-voip Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/abac Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/license Patch
@rocket.chat/media-calls Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch
@rocket.chat/server-fetch Patch

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 15, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 740c7b21-5b2f-4540-a67e-dda8d2fa56ea

📥 Commits

Reviewing files that changed from the base of the PR and between b982d4a and c62fe28.

📒 Files selected for processing (1)
  • apps/meteor/client/views/admin/moderation/ModerationConsoleTable.tsx
📜 Recent 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/moderation/ModerationConsoleTable.tsx
🧠 Learnings (3)
📚 Learning: 2026-03-04T14:16:49.202Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39304
File: packages/ui-contexts/src/ActionManagerContext.ts:26-26
Timestamp: 2026-03-04T14:16:49.202Z
Learning: In `packages/ui-contexts/src/ActionManagerContext.ts` (TypeScript, RocketChat/Rocket.Chat), the `disposeView` method in `IActionManager` uses an intentionally explicit union `UiKit.ModalView['id'] | UiKit.BannerView['viewId'] | UiKit.ContextualBarView['id']` to document which view types are accepted, even though all constituents resolve to the same primitive. The inline `// eslint-disable-next-line typescript-eslint/no-duplicate-type-constituents` comment is intentional and should not be flagged or removed.

Applied to files:

  • apps/meteor/client/views/admin/moderation/ModerationConsoleTable.tsx
📚 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/moderation/ModerationConsoleTable.tsx
📚 Learning: 2026-02-25T20:10:16.987Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38913
File: packages/ddp-client/src/legacy/types/SDKLegacy.ts:34-34
Timestamp: 2026-02-25T20:10:16.987Z
Learning: In the RocketChat/Rocket.Chat monorepo, packages/ddp-client and apps/meteor do not use TypeScript project references. Module augmentations in apps/meteor (e.g., declare module 'rocket.chat/rest-typings') are not visible when compiling packages/ddp-client in isolation, which is why legacy SDK methods that depend on OperationResult types for OpenAPI-migrated endpoints must remain commented out.

Applied to files:

  • apps/meteor/client/views/admin/moderation/ModerationConsoleTable.tsx
🔇 Additional comments (3)
apps/meteor/client/views/admin/moderation/ModerationConsoleTable.tsx (3)

2-2: Good import update for the new error-state primitives.

Line 2 adds only the required Fuselage state components used by the new error branch.


56-63: Query state wiring is clean and minimal.

Lines 56-63 correctly expose isError and refetch for UI-level failure handling while preserving the existing query behavior.


137-145: Error-state branch is implemented correctly.

Line 137’s isError && !data guard plus the reload action at Line 142 provides the expected failure UX without regressing the data-available path.


Walkthrough

Adds 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

Cohort / File(s) Summary
Changeset Metadata
.changeset/fix-missing-error-state-tables.md
Patch changeset added documenting the fix for missing error states in admin tables.
Admin Table Error Handling
apps/meteor/client/views/admin/moderation/ModerationConsoleTable.tsx, apps/meteor/client/views/admin/customUserStatus/CustomUserStatusTable/CustomUserStatusTable.tsx
Destructured isError (and refetch where used) from useQuery, imported States components from fuselage, and added conditional rendering of a States-based error UI with warning icon and a "Reload page" action. Removed // TODO: Missing error state comments.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

type: bug

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: adding missing error state handling to two specific admin table components.
Linked Issues check ✅ Passed The PR fully addresses issue #39521 by implementing error state handling in both ModerationConsoleTable and CustomUserStatusTable with warning icon, error message, and reload functionality.
Out of Scope Changes check ✅ Passed All changes are directly related to issue #39521: adding error state UI components and logic to the two specified tables, removing TODO comments, and updating the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

📝 Coding Plan
  • Generate coding plan for human review comments

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.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

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
@Avanish-Gupta-CSE Avanish-Gupta-CSE force-pushed the fix/issue-39521-missing-error-state-tables branch from 3a10ec0 to b982d4a Compare March 15, 2026 05:24
@coderabbitai coderabbitai Bot removed the type: bug label Mar 15, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
apps/meteor/client/views/admin/customUserStatus/CustomUserStatusTable/CustomUserStatusTable.tsx (1)

65-75: Consider extracting this States error 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

📥 Commits

Reviewing files that changed from the base of the PR and between 3056574 and b982d4a.

📒 Files selected for processing (3)
  • .changeset/fix-missing-error-state-tables.md
  • apps/meteor/client/views/admin/customUserStatus/CustomUserStatusTable/CustomUserStatusTable.tsx
  • apps/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.tsx
  • apps/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.tsx
  • apps/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.

isError handling 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
@Avanish-Gupta-CSE
Copy link
Copy Markdown
Author

Thanks for the review! I've addressed the feedback: the ModerationConsoleTable error state is now gated with !data to avoid hiding previously loaded table data on transient refetch failures. The CustomUserStatusTable already had this guard in place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: Missing error state in ModerationConsoleTable and CustomUserStatusTable

1 participant