Skip to content

refactor(ui-client): remove unnecessary ReactElement type annotations from components#40811

Merged
ggazzo merged 1 commit into
developfrom
refactor/prepare-types-for-react-19-9
Jun 8, 2026
Merged

refactor(ui-client): remove unnecessary ReactElement type annotations from components#40811
ggazzo merged 1 commit into
developfrom
refactor/prepare-types-for-react-19-9

Conversation

@tassoevan

@tassoevan tassoevan commented Jun 4, 2026

Copy link
Copy Markdown
Member

⚠️ This is part 9/23 of #40796. PR for refactor/prepare-types-for-react-19-8 must be merged first.


Proposed changes (including videos or screenshots)

As a first step towards upgrading to React 19, it handles types from @types/react looking forward the next major.

Issue(s)

Task: ARCH-2170

Steps to test or reproduce

Further comments

No runtime change is expected from it.

Summary by CodeRabbit

  • Refactor
    • Improved TypeScript type consistency across components by simplifying return type annotations and optimizing imports for type-only declarations.
    • Enhanced ref typing semantics for improved null-safety handling.
    • Updated prop types to accept broader React node types where appropriate.

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This PR removes explicit ReactElement return type annotations from 24 React components across the ui-client package, relying instead on TypeScript's type inference. It also widens some prop constraints from ReactElement to ReactNode and clarifies generic ReactElement types to ReactElement<any> for better compatibility.

Changes

React 19 Type Inference Refactor

Layer / File(s) Summary
Contextualbar components type simplification
src/components/Contextualbar/Contextualbar{Back,Close,InnerContent,SkeletonBody}.tsx
Removed explicit ReactElement return type annotations from four contextual bar components, allowing TypeScript to infer the return type while keeping component logic and prop handling unchanged.
Scrollbars component type adjustments
src/components/CustomScrollbars/{CustomScrollbars,CustomVirtuaScrollbars,VirtualizedScrollbars}.tsx
Widened CustomScrollbars and CustomVirtuaScrollbars children props from ReactElement to ReactNode to accept strings, numbers, and fragments. Clarified VirtualizedScrollbars children to ReactElement<any> for explicit generic typing.
Table components type simplification
src/components/GenericTable/{GenericTableHeaderCell,GenericTableLoadingRow,GenericTableLoadingTable}.tsx
Removed explicit ReactElement return type annotations from three generic table components, relying on inferred types while preserving component structure and rendering logic.
Header components type clarification
src/components/Header/{HeaderIcon,HeaderTag/HeaderTagIcon}.tsx
Clarified HeaderIconProps icon prop type from unparameterized ReactElement to ReactElement<any> in both files for explicit generic parameter specification without runtime changes.
Modal and panel component type adjustments
src/components/{Modal/GenericModal,Modal/ModalBackdrop,InfoPanel/InfoPanelAction}.tsx, src/components/Modal/GenericModal/{GenericModal,withDoNotAskAgain}.spec.tsx
Widened modal prop types: GenericModalProps title and icon clarified to ReactElement<any>, withDoNotAskAgain dontAskAgain widened to ReactNode, InfoPanelAction removed explicit return type, and ModalBackdrop updated ref signatures to allow null refs.
Provider and test infrastructure type updates
src/providers/{ModalProvider/ModalProvider.spec,TooltipProvider}.tsx
Updated test helper renderWithSuspense to accept ReactNode instead of ReactElement, and explicitly initialized lastAnchor ref with undefined in TooltipProvider for stricter initialization semantics.
SetupWizard provider and step components refactoring
src/views/setupWizard/{SetupWizardPage,SetupWizardRoute,providers/SetupWizardProvider,steps/{AdminInfoStep,CloudAccountConfirmation,OrganizationInfoStep,RegisterServerStep}}.tsx
Removed explicit ReactElement return types from wizard page and six step components. Introduced explicit SetupWizardProviderProps type with children: ReactNode to widen accepted child content types.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • RocketChat/Rocket.Chat#40805: Performs the same ReactElement return-type annotation removal and ReactNode widening pattern in other UI component files as part of the same React 19 type-cleanup effort.
  • RocketChat/Rocket.Chat#40804: Related React 19 type-cleanup refactor removing explicit ReactElement return annotations and widening content props to ReactNode in different UI components.
  • RocketChat/Rocket.Chat#40807: Parallel TypeScript-only refactor removing explicit ReactElement return type annotations from React components as part of the same cleanup initiative.

Suggested labels

type: chore

Suggested reviewers

  • MartinSchoeler
  • ggazzo
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the primary change: removing unnecessary ReactElement type annotations from components throughout the ui-client package.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (2)
  • REACT-19: Request failed with status code 401
  • ARCH-2170: Request failed with status code 401

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.

@changeset-bot

changeset-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: bb46949

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dionisio-bot

dionisio-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@codecov

codecov Bot commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.14%. Comparing base (64f281a) to head (bb46949).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #40811      +/-   ##
===========================================
- Coverage    70.18%   70.14%   -0.05%     
===========================================
  Files         3340     3340              
  Lines       123638   123638              
  Branches     22005    22010       +5     
===========================================
- Hits         86776    86726      -50     
- Misses       33520    33569      +49     
- Partials      3342     3343       +1     
Flag Coverage Δ
e2e 59.36% <ø> (-0.07%) ⬇️
e2e-api 46.22% <ø> (-0.91%) ⬇️
unit 70.98% <50.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tassoevan tassoevan force-pushed the refactor/prepare-types-for-react-19-9 branch from 28f3c67 to bb46949 Compare June 8, 2026 23:21
@tassoevan tassoevan added this to the 8.6.0 milestone Jun 8, 2026
@tassoevan tassoevan requested a review from a team June 8, 2026 23:21
@tassoevan tassoevan marked this pull request as ready for review June 8, 2026 23:22
@ggazzo ggazzo added the stat: QA assured Means it has been tested and approved by a company insider label Jun 8, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Jun 8, 2026
@tassoevan tassoevan enabled auto-merge June 8, 2026 23:26

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@packages/ui-client/src/views/setupWizard/steps/AdminInfoStep.tsx`:
- Line 17: The change adds a fallback value to useSetting in the
regexpForUsernameValidation declaration which alters initial-load validation
behavior (uses '[0-9a-zA-Z-_.]+' until settings arrive) rather than fixing a new
RegExp crash; either remove the fallback from
useSetting('UTF8_User_Names_Validation', ...) to preserve the previous temporary
behavior, or update the PR description to explicitly state this semantic change
for initial SettingsContext loading and cite that other hooks
(useNormalizedThreadTitleHtml, useE2EEncryption, useAccountProfileSettings)
already follow this pattern so reviewers understand the impact on temporary
username validation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c9ff6205-6d19-4472-897a-f94d151bd130

📥 Commits

Reviewing files that changed from the base of the PR and between 64f281a and bb46949.

📒 Files selected for processing (26)
  • packages/ui-client/src/components/Contextualbar/ContextualbarBack.tsx
  • packages/ui-client/src/components/Contextualbar/ContextualbarClose.tsx
  • packages/ui-client/src/components/Contextualbar/ContextualbarInnerContent.tsx
  • packages/ui-client/src/components/Contextualbar/ContextualbarSkeletonBody.tsx
  • packages/ui-client/src/components/CustomScrollbars/CustomScrollbars.tsx
  • packages/ui-client/src/components/CustomScrollbars/CustomVirtuaScrollbars.tsx
  • packages/ui-client/src/components/CustomScrollbars/VirtualizedScrollbars.tsx
  • packages/ui-client/src/components/GenericTable/GenericTableHeaderCell.tsx
  • packages/ui-client/src/components/GenericTable/GenericTableLoadingRow.tsx
  • packages/ui-client/src/components/GenericTable/GenericTableLoadingTable.tsx
  • packages/ui-client/src/components/Header/HeaderIcon.tsx
  • packages/ui-client/src/components/Header/HeaderTag/HeaderTagIcon.tsx
  • packages/ui-client/src/components/InfoPanel/InfoPanelAction.tsx
  • packages/ui-client/src/components/Modal/GenericModal/GenericModal.spec.tsx
  • packages/ui-client/src/components/Modal/GenericModal/GenericModal.tsx
  • packages/ui-client/src/components/Modal/GenericModal/withDoNotAskAgain.tsx
  • packages/ui-client/src/components/Modal/ModalBackdrop.tsx
  • packages/ui-client/src/providers/ModalProvider/ModalProvider.spec.tsx
  • packages/ui-client/src/providers/TooltipProvider.tsx
  • packages/ui-client/src/views/setupWizard/SetupWizardPage.tsx
  • packages/ui-client/src/views/setupWizard/SetupWizardRoute.tsx
  • packages/ui-client/src/views/setupWizard/providers/SetupWizardProvider.tsx
  • packages/ui-client/src/views/setupWizard/steps/AdminInfoStep.tsx
  • packages/ui-client/src/views/setupWizard/steps/CloudAccountConfirmation.tsx
  • packages/ui-client/src/views/setupWizard/steps/OrganizationInfoStep.tsx
  • packages/ui-client/src/views/setupWizard/steps/RegisterServerStep.tsx
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: 📦 Build Packages
  • GitHub Check: Hacktron Security Check
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🧰 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:

  • packages/ui-client/src/components/Header/HeaderTag/HeaderTagIcon.tsx
  • packages/ui-client/src/views/setupWizard/steps/OrganizationInfoStep.tsx
  • packages/ui-client/src/providers/ModalProvider/ModalProvider.spec.tsx
  • packages/ui-client/src/components/Contextualbar/ContextualbarClose.tsx
  • packages/ui-client/src/components/Header/HeaderIcon.tsx
  • packages/ui-client/src/views/setupWizard/steps/AdminInfoStep.tsx
  • packages/ui-client/src/views/setupWizard/SetupWizardRoute.tsx
  • packages/ui-client/src/components/CustomScrollbars/CustomScrollbars.tsx
  • packages/ui-client/src/providers/TooltipProvider.tsx
  • packages/ui-client/src/components/CustomScrollbars/VirtualizedScrollbars.tsx
  • packages/ui-client/src/components/GenericTable/GenericTableHeaderCell.tsx
  • packages/ui-client/src/components/Contextualbar/ContextualbarBack.tsx
  • packages/ui-client/src/components/InfoPanel/InfoPanelAction.tsx
  • packages/ui-client/src/components/CustomScrollbars/CustomVirtuaScrollbars.tsx
  • packages/ui-client/src/components/Contextualbar/ContextualbarSkeletonBody.tsx
  • packages/ui-client/src/components/Modal/GenericModal/GenericModal.spec.tsx
  • packages/ui-client/src/views/setupWizard/steps/RegisterServerStep.tsx
  • packages/ui-client/src/components/Modal/GenericModal/withDoNotAskAgain.tsx
  • packages/ui-client/src/views/setupWizard/steps/CloudAccountConfirmation.tsx
  • packages/ui-client/src/views/setupWizard/providers/SetupWizardProvider.tsx
  • packages/ui-client/src/components/GenericTable/GenericTableLoadingTable.tsx
  • packages/ui-client/src/components/Modal/GenericModal/GenericModal.tsx
  • packages/ui-client/src/views/setupWizard/SetupWizardPage.tsx
  • packages/ui-client/src/components/Modal/ModalBackdrop.tsx
  • packages/ui-client/src/components/Contextualbar/ContextualbarInnerContent.tsx
  • packages/ui-client/src/components/GenericTable/GenericTableLoadingRow.tsx
🧠 Learnings (3)
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.

Applied to files:

  • packages/ui-client/src/components/Header/HeaderTag/HeaderTagIcon.tsx
  • packages/ui-client/src/views/setupWizard/steps/OrganizationInfoStep.tsx
  • packages/ui-client/src/providers/ModalProvider/ModalProvider.spec.tsx
  • packages/ui-client/src/components/Contextualbar/ContextualbarClose.tsx
  • packages/ui-client/src/components/Header/HeaderIcon.tsx
  • packages/ui-client/src/views/setupWizard/steps/AdminInfoStep.tsx
  • packages/ui-client/src/views/setupWizard/SetupWizardRoute.tsx
  • packages/ui-client/src/components/CustomScrollbars/CustomScrollbars.tsx
  • packages/ui-client/src/providers/TooltipProvider.tsx
  • packages/ui-client/src/components/CustomScrollbars/VirtualizedScrollbars.tsx
  • packages/ui-client/src/components/GenericTable/GenericTableHeaderCell.tsx
  • packages/ui-client/src/components/Contextualbar/ContextualbarBack.tsx
  • packages/ui-client/src/components/InfoPanel/InfoPanelAction.tsx
  • packages/ui-client/src/components/CustomScrollbars/CustomVirtuaScrollbars.tsx
  • packages/ui-client/src/components/Contextualbar/ContextualbarSkeletonBody.tsx
  • packages/ui-client/src/components/Modal/GenericModal/GenericModal.spec.tsx
  • packages/ui-client/src/views/setupWizard/steps/RegisterServerStep.tsx
  • packages/ui-client/src/components/Modal/GenericModal/withDoNotAskAgain.tsx
  • packages/ui-client/src/views/setupWizard/steps/CloudAccountConfirmation.tsx
  • packages/ui-client/src/views/setupWizard/providers/SetupWizardProvider.tsx
  • packages/ui-client/src/components/GenericTable/GenericTableLoadingTable.tsx
  • packages/ui-client/src/components/Modal/GenericModal/GenericModal.tsx
  • packages/ui-client/src/views/setupWizard/SetupWizardPage.tsx
  • packages/ui-client/src/components/Modal/ModalBackdrop.tsx
  • packages/ui-client/src/components/Contextualbar/ContextualbarInnerContent.tsx
  • packages/ui-client/src/components/GenericTable/GenericTableLoadingRow.tsx
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • packages/ui-client/src/components/Header/HeaderTag/HeaderTagIcon.tsx
  • packages/ui-client/src/views/setupWizard/steps/OrganizationInfoStep.tsx
  • packages/ui-client/src/providers/ModalProvider/ModalProvider.spec.tsx
  • packages/ui-client/src/components/Contextualbar/ContextualbarClose.tsx
  • packages/ui-client/src/components/Header/HeaderIcon.tsx
  • packages/ui-client/src/views/setupWizard/steps/AdminInfoStep.tsx
  • packages/ui-client/src/views/setupWizard/SetupWizardRoute.tsx
  • packages/ui-client/src/components/CustomScrollbars/CustomScrollbars.tsx
  • packages/ui-client/src/providers/TooltipProvider.tsx
  • packages/ui-client/src/components/CustomScrollbars/VirtualizedScrollbars.tsx
  • packages/ui-client/src/components/GenericTable/GenericTableHeaderCell.tsx
  • packages/ui-client/src/components/Contextualbar/ContextualbarBack.tsx
  • packages/ui-client/src/components/InfoPanel/InfoPanelAction.tsx
  • packages/ui-client/src/components/CustomScrollbars/CustomVirtuaScrollbars.tsx
  • packages/ui-client/src/components/Contextualbar/ContextualbarSkeletonBody.tsx
  • packages/ui-client/src/components/Modal/GenericModal/GenericModal.spec.tsx
  • packages/ui-client/src/views/setupWizard/steps/RegisterServerStep.tsx
  • packages/ui-client/src/components/Modal/GenericModal/withDoNotAskAgain.tsx
  • packages/ui-client/src/views/setupWizard/steps/CloudAccountConfirmation.tsx
  • packages/ui-client/src/views/setupWizard/providers/SetupWizardProvider.tsx
  • packages/ui-client/src/components/GenericTable/GenericTableLoadingTable.tsx
  • packages/ui-client/src/components/Modal/GenericModal/GenericModal.tsx
  • packages/ui-client/src/views/setupWizard/SetupWizardPage.tsx
  • packages/ui-client/src/components/Modal/ModalBackdrop.tsx
  • packages/ui-client/src/components/Contextualbar/ContextualbarInnerContent.tsx
  • packages/ui-client/src/components/GenericTable/GenericTableLoadingRow.tsx
📚 Learning: 2026-03-06T18:10:15.268Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/code/CodeBlock.spec.tsx:47-68
Timestamp: 2026-03-06T18:10:15.268Z
Learning: In tests (especially those using testing-library/dom/jsdom) for Rocket.Chat components, the HTML <code> element has an implicit ARIA role of 'code'. Therefore, screen.getByRole('code') or screen.findByRole('code') will locate <code> elements even without a role attribute. Do not flag findByRole('code') as invalid in reviews; prefer using the implicit role instead of adding role="code" unless necessary for accessibility.

Applied to files:

  • packages/ui-client/src/providers/ModalProvider/ModalProvider.spec.tsx
  • packages/ui-client/src/components/Modal/GenericModal/GenericModal.spec.tsx
🔇 Additional comments (26)
packages/ui-client/src/components/InfoPanel/InfoPanelAction.tsx (1)

3-3: LGTM!

Also applies to: 10-10

packages/ui-client/src/components/Modal/GenericModal/GenericModal.spec.tsx (1)

6-6: LGTM!

Also applies to: 12-12

packages/ui-client/src/components/Modal/GenericModal/GenericModal.tsx (1)

32-33: LGTM!

packages/ui-client/src/components/Modal/GenericModal/withDoNotAskAgain.tsx (1)

3-3: LGTM!

Also applies to: 18-18, 21-21

packages/ui-client/src/components/Modal/ModalBackdrop.tsx (1)

24-24: LGTM!

Also applies to: 31-31

packages/ui-client/src/components/Contextualbar/ContextualbarBack.tsx (1)

1-1: LGTM!

Also applies to: 9-9

packages/ui-client/src/components/Contextualbar/ContextualbarClose.tsx (1)

1-1: LGTM!

Also applies to: 9-9

packages/ui-client/src/components/CustomScrollbars/CustomScrollbars.tsx (1)

2-2: LGTM!

Also applies to: 9-9

packages/ui-client/src/components/CustomScrollbars/CustomVirtuaScrollbars.tsx (1)

2-2: LGTM!

Also applies to: 8-8

packages/ui-client/src/components/CustomScrollbars/VirtualizedScrollbars.tsx (1)

9-9: LGTM!

packages/ui-client/src/components/Contextualbar/ContextualbarInnerContent.tsx (1)

2-5: LGTM!

packages/ui-client/src/components/Contextualbar/ContextualbarSkeletonBody.tsx (1)

5-5: LGTM!

packages/ui-client/src/components/GenericTable/GenericTableHeaderCell.tsx (1)

2-2: LGTM!

Also applies to: 21-21

packages/ui-client/src/components/GenericTable/GenericTableLoadingRow.tsx (1)

3-3: LGTM!

packages/ui-client/src/components/GenericTable/GenericTableLoadingTable.tsx (1)

3-3: LGTM!

packages/ui-client/src/components/Header/HeaderIcon.tsx (1)

5-5: LGTM!

packages/ui-client/src/components/Header/HeaderTag/HeaderTagIcon.tsx (1)

6-6: LGTM!

packages/ui-client/src/providers/ModalProvider/ModalProvider.spec.tsx (1)

4-4: LGTM!

Also applies to: 13-13

packages/ui-client/src/providers/TooltipProvider.tsx (1)

14-14: LGTM!

packages/ui-client/src/views/setupWizard/SetupWizardRoute.tsx (1)

10-10: LGTM!

packages/ui-client/src/views/setupWizard/providers/SetupWizardProvider.tsx (1)

14-14: LGTM!

Also applies to: 40-45

packages/ui-client/src/views/setupWizard/steps/RegisterServerStep.tsx (1)

4-4: LGTM!

Also applies to: 17-17

packages/ui-client/src/views/setupWizard/SetupWizardPage.tsx (1)

7-7: LGTM!

packages/ui-client/src/views/setupWizard/steps/AdminInfoStep.tsx (1)

4-4: LGTM!

Also applies to: 15-15

packages/ui-client/src/views/setupWizard/steps/CloudAccountConfirmation.tsx (1)

10-10: LGTM!

packages/ui-client/src/views/setupWizard/steps/OrganizationInfoStep.tsx (1)

6-6: LGTM!

Also applies to: 29-29

const AdminInfoStep = () => {
const { t, i18n } = useTranslation();
const regexpForUsernameValidation = useSetting('UTF8_User_Names_Validation');
const regexpForUsernameValidation = useSetting('UTF8_User_Names_Validation', '[0-9a-zA-Z-_.]+');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if UTF8_User_Names_Validation setting is guaranteed to exist
rg -n -C3 "UTF8_User_Names_Validation" --type ts --type js -g '!*.spec.*' -g '!*.test.*'

Repository: RocketChat/Rocket.Chat

Length of output: 7672


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# 1) Inspect the relevant part of AdminInfoStep.tsx
echo "=== AdminInfoStep.tsx (context around useSetting) ==="
sed -n '1,120p' packages/ui-client/src/views/setupWizard/steps/AdminInfoStep.tsx

# 2) Find the useSetting hook definition and inspect its signature (to see if fallback is supported/expected)
echo "=== Searching for useSetting implementation/signature ==="
fd -t f -e ts -e tsx -e js -e jsx -e d.ts "useSetting" packages/ui-client/src | head -n 50

# Also search globally for the hook definition
rg -n "function useSetting|const useSetting|export (function|const) useSetting" packages/ui-client/src --hidden

# 3) Check other UI usages of useSetting with a fallback for UTF8_User_Names_Validation
echo "=== Other useSetting('UTF8_User_Names_Validation', ...) usages in ui-client ==="
rg -n "useSetting\('UTF8_User_Names_Validation'" packages/ui-client/src

# 4) If available, compare the setting default on the server side (already partially found, but re-show the exact add)
echo "=== Server setting default for UTF8_User_Names_Validation ==="
rg -n "add\\('UTF8_User_Names_Validation'" apps/meteor/server/settings/general.ts

Repository: RocketChat/Rocket.Chat

Length of output: 3106


🏁 Script executed:

#!/bin/bash
set -uo pipefail

echo "=== Searching for useSetting definition/signature across repo ==="
rg -n --hidden --no-ignore-vcs \
  "export (const|function) useSetting|function useSetting|const useSetting" . \
  --glob '!**/node_modules/**' --glob '!**/dist/**' --glob '!**/build/**' | head -n 50

echo "=== Searching for useSetting type declaration (d.ts) ==="
fd -e d.ts -e ts -e tsx --hidden useSetting . 2>/dev/null | head -n 50

# Find any d.ts files that mention UTF8_User_Names_Validation defaults/fallback
rg -n --hidden --no-ignore-vcs "useSetting\\(.*UTF8_User_Names_Validation" . \
  --glob '!**/node_modules/**' --glob '!**/dist/**' --glob '!**/build/**' | head -n 50

Repository: RocketChat/Rocket.Chat

Length of output: 3450


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== packages/ui-contexts/src/hooks/useSetting.ts ==="
sed -n '1,200p' packages/ui-contexts/src/hooks/useSetting.ts

echo "=== Server default for UTF8_User_Names_Validation ==="
sed -n '240,310p' apps/meteor/server/settings/general.ts

echo "=== Server validateUsername fallback behavior ==="
sed -n '1,120p' apps/meteor/app/lib/server/functions/validateUsername.ts

echo "=== Other ui-client usages of fallback for UTF8_User_Names_Validation ==="
for f in \
  apps/meteor/client/views/room/contextualBar/Threads/hooks/useNormalizedThreadTitleHtml.ts \
  apps/meteor/client/views/root/hooks/loggedIn/useE2EEncryption.ts \
  apps/meteor/client/views/account/profile/useAccountProfileSettings.ts
do
  echo "---- $f ----"
  sed -n '1,80p' "$f"
done

Repository: RocketChat/Rocket.Chat

Length of output: 8885


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== packages/ui-contexts/src/hooks/useSettingStructure.ts ==="
sed -n '1,200p' packages/ui-contexts/src/hooks/useSettingStructure.ts

echo "=== packages/ui-contexts/src/hooks/useSettings.ts ==="
sed -n '1,200p' packages/ui-contexts/src/hooks/useSettings.ts

echo "=== packages/ui-contexts/src/hooks/useSettingSetValue.ts ==="
sed -n '1,120p' packages/ui-contexts/src/hooks/useSettingSetValue.ts

echo "=== Search for SettingsContext default/initial state ==="
rg -n "SettingsContext|createContext" packages/ui-contexts/src --hidden

# show the SettingsContext provider if it exists
fd -t f -e ts -e tsx "SettingsContext" packages/ui-contexts/src --hidden | head -n 20

Repository: RocketChat/Rocket.Chat

Length of output: 7717


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== packages/ui-contexts/src/SettingsContext.ts ==="
sed -n '1,120p' packages/ui-contexts/src/SettingsContext.ts

echo "=== Inspect SettingsContextValue/querySetting behavior ==="
sed -n '120,260p' packages/ui-contexts/src/SettingsContext.ts

Repository: RocketChat/Rocket.Chat

Length of output: 1275


🏁 Script executed:

#!/bin/bash
# Find any UI usages of UTF8_User_Names_Validation without a fallback
rg -n --hidden "useSetting\\('UTF8_User_Names_Validation'\\)" --type ts --type tsx packages/ui-client/src apps/meteor/client/views -g '!*.spec.*' -g '!*.test.*'

Repository: RocketChat/Rocket.Chat

Length of output: 94


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== UI usages of useSetting('UTF8_User_Names_Validation') without fallback ==="
rg -n --hidden --no-ignore-vcs \
  "useSetting\\(['\"]UTF8_User_Names_Validation['\"]\\)" \
  packages/ui-client apps/meteor/client \
  -g '!*.spec.*' -g '!*.test.*'

echo "=== UI usages of useSetting('UTF8_User_Names_Validation', ... ) ==="
rg -n --hidden --no-ignore-vcs \
  "useSetting\\(['\"]UTF8_User_Names_Validation['\"],\\s*[^\\)]+" \
  packages/ui-client apps/meteor/client \
  -g '!*.spec.*' -g '!*.test.*'

Repository: RocketChat/Rocket.Chat

Length of output: 145


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== UI usages of useSetting('UTF8_User_Names_Validation') ==="
rg -n --hidden --no-ignore-vcs \
  "useSetting\\(['\"]UTF8_User_Names_Validation['\"]\\)" \
  packages/ui-client apps/meteor/client \
  -g '!*.spec.*' -g '!*.test.*' || true

echo "=== UI usages of useSetting('UTF8_User_Names_Validation', <fallback>) ==="
rg -n --hidden --no-ignore-vcs \
  "useSetting\\(['\"]UTF8_User_Names_Validation['\"],\\s*[^\\)]+\\)" \
  packages/ui-client apps/meteor/client \
  -g '!*.spec.*' -g '!*.test.*' || true

Repository: RocketChat/Rocket.Chat

Length of output: 846


Clarify impact of adding useSetting fallback for UTF8_User_Names_Validation

useSetting already supports the provided fallback, so this doesn’t look like a crash fix at new RegExp(...). Instead, it changes the temporary username-validation behavior during SettingsContext loading: without the fallback, the interpolated value could be undefined (yielding an incorrect ^undefined$ regex) until the setting arrives; with the fallback it uses [0-9a-zA-Z-_.]+.

This fallback pattern is already used in other client code (useNormalizedThreadTitleHtml, useE2EEncryption, useAccountProfileSettings), so confirm the PR description’s “no runtime behavior changes expected” wording accounts for this initial-load validation semantics.

🤖 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/ui-client/src/views/setupWizard/steps/AdminInfoStep.tsx` at line 17,
The change adds a fallback value to useSetting in the
regexpForUsernameValidation declaration which alters initial-load validation
behavior (uses '[0-9a-zA-Z-_.]+' until settings arrive) rather than fixing a new
RegExp crash; either remove the fallback from
useSetting('UTF8_User_Names_Validation', ...) to preserve the previous temporary
behavior, or update the PR description to explicitly state this semantic change
for initial SettingsContext loading and cite that other hooks
(useNormalizedThreadTitleHtml, useE2EEncryption, useAccountProfileSettings)
already follow this pattern so reviewers understand the impact on temporary
username validation.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2 issues found across 26 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="packages/ui-client/src/views/setupWizard/steps/AdminInfoStep.tsx">

<violation number="1" location="packages/ui-client/src/views/setupWizard/steps/AdminInfoStep.tsx:17">
P2: Adding a fallback value to `useSetting` changes runtime behavior, contradicting PR description claims of "no runtime behavior changes." Previously the fallback was implicitly `undefined`; now it's `'[0-9a-zA-Z-_.]+'`. If intended as a pre-existing bugfix, the PR description/scope should be updated to reflect the runtime impact.</violation>
</file>

<file name="packages/ui-client/src/components/CustomScrollbars/CustomVirtuaScrollbars.tsx">

<violation number="1" location="packages/ui-client/src/components/CustomScrollbars/CustomVirtuaScrollbars.tsx:8">
P2: `children` was widened to `ReactNode`, but this component requires an element child for `firstElementChild`-based initialization; the new type allows inputs that silently break scrollbar setup.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

const AdminInfoStep = () => {
const { t, i18n } = useTranslation();
const regexpForUsernameValidation = useSetting('UTF8_User_Names_Validation');
const regexpForUsernameValidation = useSetting('UTF8_User_Names_Validation', '[0-9a-zA-Z-_.]+');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: Adding a fallback value to useSetting changes runtime behavior, contradicting PR description claims of "no runtime behavior changes." Previously the fallback was implicitly undefined; now it's '[0-9a-zA-Z-_.]+'. If intended as a pre-existing bugfix, the PR description/scope should be updated to reflect the runtime impact.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/ui-client/src/views/setupWizard/steps/AdminInfoStep.tsx, line 17:

<comment>Adding a fallback value to `useSetting` changes runtime behavior, contradicting PR description claims of "no runtime behavior changes." Previously the fallback was implicitly `undefined`; now it's `'[0-9a-zA-Z-_.]+'`. If intended as a pre-existing bugfix, the PR description/scope should be updated to reflect the runtime impact.</comment>

<file context>
@@ -12,9 +12,9 @@ const usernameBlackList = ['all', 'here', 'admin'].map(toRegExp);
+const AdminInfoStep = () => {
 	const { t, i18n } = useTranslation();
-	const regexpForUsernameValidation = useSetting('UTF8_User_Names_Validation');
+	const regexpForUsernameValidation = useSetting('UTF8_User_Names_Validation', '[0-9a-zA-Z-_.]+');
 	const usernameRegExp = new RegExp(`^${regexpForUsernameValidation}$`);
 
</file context>


type CustomScrollbarsProps = {
children: ReactElement;
children: ReactNode;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: children was widened to ReactNode, but this component requires an element child for firstElementChild-based initialization; the new type allows inputs that silently break scrollbar setup.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/ui-client/src/components/CustomScrollbars/CustomVirtuaScrollbars.tsx, line 8:

<comment>`children` was widened to `ReactNode`, but this component requires an element child for `firstElementChild`-based initialization; the new type allows inputs that silently break scrollbar setup.</comment>

<file context>
@@ -1,11 +1,11 @@
 
 type CustomScrollbarsProps = {
-	children: ReactElement;
+	children: ReactNode;
 } & Omit<HTMLAttributes<HTMLDivElement>, 'is' | 'onScroll'>;
 
</file context>

@ggazzo ggazzo disabled auto-merge June 8, 2026 23:55
@ggazzo ggazzo merged commit 027d784 into develop Jun 8, 2026
46 checks passed
@ggazzo ggazzo deleted the refactor/prepare-types-for-react-19-9 branch June 8, 2026 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge type: chore

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants