Skip to content

refactor: tidy RoomView components - #7641

Merged
diegolmello merged 2 commits into
native-34-roomview-hooksfrom
native-34-components-simplify
Sep 3, 2026
Merged

refactor: tidy RoomView components#7641
diegolmello merged 2 commits into
native-34-roomview-hooksfrom
native-34-components-simplify

Conversation

@diegolmello

@diegolmello diegolmello commented Sep 3, 2026

Copy link
Copy Markdown
Member

Proposed changes

Cleanup pass over the RoomView components, on top of the RoomView hooks migration.

  • RoomProviders and RoomMessageProvider spread {...props} into their providers. Every field is now passed explicitly, so what each provider actually supplies is readable at the call site.
  • MessageRow built its output into a let content through an if/else chain and wrapped a render-time decision in a nested runOnRender function. Now early returns and a plain boolean.
  • RightButtons had a @ts-ignore on goSearchView because it navigated directly instead of through the file's own navigateToScreen helper. Routing it through the helper drops the suppression; the two branches keep their distinct params, and the modal branch now also passes the t it was required to.
  • Threads_enabled and Livechat_request_comment_when_closing_conversation in RightButtons, plus the federation settings in useRoomFooterState and useFooterMessage, read through useSetting instead of a raw useAppSelector with a cast. The federation settings are read unconditionally: a short-circuit between two useSetting calls makes the hook order depend on the first value, which breaks the rules of hooks and fails reactCompilerContract.test.ts.
  • RoomPlaceholder ran StyleSheet.create on every render. Hoisted to a module-level stylesheet with the four color values applied inline, matching RoomFooter/styles.ts.
  • Banner's hand-written memo comparator ignored title and closeBanner, so it could hold a stale banner on screen. Replaced with a plain memo.
  • InvitedRoom's loading prop had no caller passing it.

Issue(s)

https://rocketchat.atlassian.net/browse/NATIVE-34

How to test or reproduce

Open a room and exercise the header buttons (search, threads, kebab), the footer states (preview, on hold, take/join, airgapped), an invited room, and the room placeholder during load. Behavior should be unchanged.

Screenshots

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves a current function)
  • New feature (non-breaking change which adds functionality)
  • Documentation update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • I have added necessary documentation (if applicable)
  • Any dependent changes have been merged and published in downstream modules

Further comments

Targets native-34-roomview-hooks (#7482), not develop.

Three resolveJumpAnchor fromServer tests fail on this branch. They also fail on native-34-roomview-hooks unchanged, so they are pre-existing there and not caused by these changes.

Considered and not done, since each needs edits outside these components:

  • placeOnHoldLivechat and closeLivechat are duplicated statement for statement with RoomActionsView; extracting to app/lib/methods/helpers would need that view changed too.
  • JoinCode calls joinRoom from restApi directly rather than the store service. Routing it through the service would skip logEvent(ROOM_JOIN) and log(e), which is a behavior change, not a cleanup.
  • AirgappedWs could render through Preview, but the title colors differ, so it would be a visual change.
  • The structural items: routing the useRoomMessaging handlers through context instead of prop threading, moving the join-code trigger into RoomStore state, extracting useRightButtons, and converting UploadProgress off its class component.
  • The efficiency findings all land in hooks/ and stores/. The sharpest: last_message sits in OBSERVED_COLUMNS, so the room observer wakes on every message in every room to compute a livechat-only value.

Summary by CodeRabbit

  • Bug Fixes

    • Improved search navigation consistency across room views.
    • Room federation and air-gapped workspace settings are now handled consistently.
  • Changes

    • Removed loading-state indicators from invited-room accept and reject actions.
    • Updated room placeholders to apply theme colors more reliably.
  • Refactor

    • Simplified room message rendering, provider configuration, and settings access.
    • Streamlined component prop handling and memoization without changing intended rendering behavior.

Pass provider props explicitly instead of spreading, flatten MessageRow into early returns, route goSearchView through navigateToScreen so the ts-ignore can go, and read settings through useSetting.

Hoist RoomPlaceholder's stylesheet to module scope, drop Banner's memo comparator that ignored title and closeBanner, and remove InvitedRoom's unused loading prop.
@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 476dd5f0-7c5a-4c36-96d0-29a51597394c

📥 Commits

Reviewing files that changed from the base of the PR and between 8e4d389 and 8098bbb.

📒 Files selected for processing (11)
  • app/views/RoomView/components/Banner.tsx
  • app/views/RoomView/components/InvitedRoom.tsx
  • app/views/RoomView/components/MessageRow.tsx
  • app/views/RoomView/components/RightButtons.tsx
  • app/views/RoomView/components/RoomFooter/TakeOrJoin.tsx
  • app/views/RoomView/components/RoomFooter/useFooterMessage.ts
  • app/views/RoomView/components/RoomFooter/useRoomFooterState.ts
  • app/views/RoomView/components/RoomMessageProvider.tsx
  • app/views/RoomView/components/RoomPlaceholder.tsx
  • app/views/RoomView/components/RoomProviders.tsx
  • app/views/RoomView/definitions.ts

Walkthrough

RoomView updates settings access, navigation, provider prop forwarding, component rendering, placeholder styling, and definition comments. Invitation button loading props are removed.

Changes

RoomView cleanup

Layer / File(s) Summary
Settings hooks and search navigation
app/views/RoomView/components/RightButtons.tsx, app/views/RoomView/components/RoomFooter/...
Selected settings now use useSetting. Search navigation now uses navigateToScreen in both branches.
Explicit provider prop wiring
app/views/RoomView/components/RoomMessageProvider.tsx, app/views/RoomView/components/RoomProviders.tsx
Provider props are destructured and passed explicitly instead of through object spreads.
Component rendering, styling, and definition cleanup
app/views/RoomView/components/Banner.tsx, app/views/RoomView/components/InvitedRoom.tsx, app/views/RoomView/components/MessageRow.tsx, app/views/RoomView/components/RoomPlaceholder.tsx, app/views/RoomView/definitions.ts
Rendering logic is simplified, invitation button loading props are removed, placeholder theme colors are applied inline, and explanatory comments are reduced.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested labels: type: chore


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.

…ative-34-components-simplify

# Conflicts:
#	app/views/RoomView/components/RoomMessageProvider.tsx
@diegolmello
diegolmello merged commit bad92c2 into native-34-roomview-hooks Sep 3, 2026
6 of 7 checks passed
@diegolmello
diegolmello deleted the native-34-components-simplify branch September 3, 2026 19:31
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.

1 participant