refactor(ui-client): remove unnecessary ReactElement type annotations from components#40811
Conversation
WalkthroughThis PR removes explicit ChangesReact 19 Type Inference Refactor
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 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. Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (2)
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 |
|
|
Looks like this PR is ready to merge! 🎉 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
28f3c67 to
bb46949
Compare
There was a problem hiding this comment.
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
📒 Files selected for processing (26)
packages/ui-client/src/components/Contextualbar/ContextualbarBack.tsxpackages/ui-client/src/components/Contextualbar/ContextualbarClose.tsxpackages/ui-client/src/components/Contextualbar/ContextualbarInnerContent.tsxpackages/ui-client/src/components/Contextualbar/ContextualbarSkeletonBody.tsxpackages/ui-client/src/components/CustomScrollbars/CustomScrollbars.tsxpackages/ui-client/src/components/CustomScrollbars/CustomVirtuaScrollbars.tsxpackages/ui-client/src/components/CustomScrollbars/VirtualizedScrollbars.tsxpackages/ui-client/src/components/GenericTable/GenericTableHeaderCell.tsxpackages/ui-client/src/components/GenericTable/GenericTableLoadingRow.tsxpackages/ui-client/src/components/GenericTable/GenericTableLoadingTable.tsxpackages/ui-client/src/components/Header/HeaderIcon.tsxpackages/ui-client/src/components/Header/HeaderTag/HeaderTagIcon.tsxpackages/ui-client/src/components/InfoPanel/InfoPanelAction.tsxpackages/ui-client/src/components/Modal/GenericModal/GenericModal.spec.tsxpackages/ui-client/src/components/Modal/GenericModal/GenericModal.tsxpackages/ui-client/src/components/Modal/GenericModal/withDoNotAskAgain.tsxpackages/ui-client/src/components/Modal/ModalBackdrop.tsxpackages/ui-client/src/providers/ModalProvider/ModalProvider.spec.tsxpackages/ui-client/src/providers/TooltipProvider.tsxpackages/ui-client/src/views/setupWizard/SetupWizardPage.tsxpackages/ui-client/src/views/setupWizard/SetupWizardRoute.tsxpackages/ui-client/src/views/setupWizard/providers/SetupWizardProvider.tsxpackages/ui-client/src/views/setupWizard/steps/AdminInfoStep.tsxpackages/ui-client/src/views/setupWizard/steps/CloudAccountConfirmation.tsxpackages/ui-client/src/views/setupWizard/steps/OrganizationInfoStep.tsxpackages/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.tsxpackages/ui-client/src/views/setupWizard/steps/OrganizationInfoStep.tsxpackages/ui-client/src/providers/ModalProvider/ModalProvider.spec.tsxpackages/ui-client/src/components/Contextualbar/ContextualbarClose.tsxpackages/ui-client/src/components/Header/HeaderIcon.tsxpackages/ui-client/src/views/setupWizard/steps/AdminInfoStep.tsxpackages/ui-client/src/views/setupWizard/SetupWizardRoute.tsxpackages/ui-client/src/components/CustomScrollbars/CustomScrollbars.tsxpackages/ui-client/src/providers/TooltipProvider.tsxpackages/ui-client/src/components/CustomScrollbars/VirtualizedScrollbars.tsxpackages/ui-client/src/components/GenericTable/GenericTableHeaderCell.tsxpackages/ui-client/src/components/Contextualbar/ContextualbarBack.tsxpackages/ui-client/src/components/InfoPanel/InfoPanelAction.tsxpackages/ui-client/src/components/CustomScrollbars/CustomVirtuaScrollbars.tsxpackages/ui-client/src/components/Contextualbar/ContextualbarSkeletonBody.tsxpackages/ui-client/src/components/Modal/GenericModal/GenericModal.spec.tsxpackages/ui-client/src/views/setupWizard/steps/RegisterServerStep.tsxpackages/ui-client/src/components/Modal/GenericModal/withDoNotAskAgain.tsxpackages/ui-client/src/views/setupWizard/steps/CloudAccountConfirmation.tsxpackages/ui-client/src/views/setupWizard/providers/SetupWizardProvider.tsxpackages/ui-client/src/components/GenericTable/GenericTableLoadingTable.tsxpackages/ui-client/src/components/Modal/GenericModal/GenericModal.tsxpackages/ui-client/src/views/setupWizard/SetupWizardPage.tsxpackages/ui-client/src/components/Modal/ModalBackdrop.tsxpackages/ui-client/src/components/Contextualbar/ContextualbarInnerContent.tsxpackages/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.tsxpackages/ui-client/src/views/setupWizard/steps/OrganizationInfoStep.tsxpackages/ui-client/src/providers/ModalProvider/ModalProvider.spec.tsxpackages/ui-client/src/components/Contextualbar/ContextualbarClose.tsxpackages/ui-client/src/components/Header/HeaderIcon.tsxpackages/ui-client/src/views/setupWizard/steps/AdminInfoStep.tsxpackages/ui-client/src/views/setupWizard/SetupWizardRoute.tsxpackages/ui-client/src/components/CustomScrollbars/CustomScrollbars.tsxpackages/ui-client/src/providers/TooltipProvider.tsxpackages/ui-client/src/components/CustomScrollbars/VirtualizedScrollbars.tsxpackages/ui-client/src/components/GenericTable/GenericTableHeaderCell.tsxpackages/ui-client/src/components/Contextualbar/ContextualbarBack.tsxpackages/ui-client/src/components/InfoPanel/InfoPanelAction.tsxpackages/ui-client/src/components/CustomScrollbars/CustomVirtuaScrollbars.tsxpackages/ui-client/src/components/Contextualbar/ContextualbarSkeletonBody.tsxpackages/ui-client/src/components/Modal/GenericModal/GenericModal.spec.tsxpackages/ui-client/src/views/setupWizard/steps/RegisterServerStep.tsxpackages/ui-client/src/components/Modal/GenericModal/withDoNotAskAgain.tsxpackages/ui-client/src/views/setupWizard/steps/CloudAccountConfirmation.tsxpackages/ui-client/src/views/setupWizard/providers/SetupWizardProvider.tsxpackages/ui-client/src/components/GenericTable/GenericTableLoadingTable.tsxpackages/ui-client/src/components/Modal/GenericModal/GenericModal.tsxpackages/ui-client/src/views/setupWizard/SetupWizardPage.tsxpackages/ui-client/src/components/Modal/ModalBackdrop.tsxpackages/ui-client/src/components/Contextualbar/ContextualbarInnerContent.tsxpackages/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.tsxpackages/ui-client/src/views/setupWizard/steps/OrganizationInfoStep.tsxpackages/ui-client/src/providers/ModalProvider/ModalProvider.spec.tsxpackages/ui-client/src/components/Contextualbar/ContextualbarClose.tsxpackages/ui-client/src/components/Header/HeaderIcon.tsxpackages/ui-client/src/views/setupWizard/steps/AdminInfoStep.tsxpackages/ui-client/src/views/setupWizard/SetupWizardRoute.tsxpackages/ui-client/src/components/CustomScrollbars/CustomScrollbars.tsxpackages/ui-client/src/providers/TooltipProvider.tsxpackages/ui-client/src/components/CustomScrollbars/VirtualizedScrollbars.tsxpackages/ui-client/src/components/GenericTable/GenericTableHeaderCell.tsxpackages/ui-client/src/components/Contextualbar/ContextualbarBack.tsxpackages/ui-client/src/components/InfoPanel/InfoPanelAction.tsxpackages/ui-client/src/components/CustomScrollbars/CustomVirtuaScrollbars.tsxpackages/ui-client/src/components/Contextualbar/ContextualbarSkeletonBody.tsxpackages/ui-client/src/components/Modal/GenericModal/GenericModal.spec.tsxpackages/ui-client/src/views/setupWizard/steps/RegisterServerStep.tsxpackages/ui-client/src/components/Modal/GenericModal/withDoNotAskAgain.tsxpackages/ui-client/src/views/setupWizard/steps/CloudAccountConfirmation.tsxpackages/ui-client/src/views/setupWizard/providers/SetupWizardProvider.tsxpackages/ui-client/src/components/GenericTable/GenericTableLoadingTable.tsxpackages/ui-client/src/components/Modal/GenericModal/GenericModal.tsxpackages/ui-client/src/views/setupWizard/SetupWizardPage.tsxpackages/ui-client/src/components/Modal/ModalBackdrop.tsxpackages/ui-client/src/components/Contextualbar/ContextualbarInnerContent.tsxpackages/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.tsxpackages/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-_.]+'); |
There was a problem hiding this comment.
🧩 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.tsRepository: 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 50Repository: 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"
doneRepository: 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 20Repository: 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.tsRepository: 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.*' || trueRepository: 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.
There was a problem hiding this comment.
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-_.]+'); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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>
Proposed changes (including videos or screenshots)
As a first step towards upgrading to React 19, it handles types from
@types/reactlooking 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