refactor(RoomView): first-tier simplifications after the hooks migration - #7635
Merged
diegolmello merged 71 commits intoSep 3, 2026
Merged
Conversation
useThreadFollowing subscribed inside a promise callback, so a room opened and closed before getMessageById resolved left the observer running: the cleanup ran while unsubscribe was still undefined. A cancelled flag set in cleanup and checked before subscribing closes that window, and also covers a tmid/userId change, where cleanup runs before the pending resolve. Dropped the paired suggestion to swap observe() for observeWithColumns(['replies']): observeWithColumns is a Query method, not a Model one, so it is not available on the record getMessageById returns. The derived value is a boolean, so setState already bails out when it does not change.
The room observer woke on every incoming message, rebuilding roomUpdate and re-rendering the root, providers, list, footer and composer. Livechat is the only consumer of last_message: it now gets its own observer, created only for t === 'l', publishing lastMessageFromAgent into the room store.
…chor and the rejoin
joinRoom no longer reads the redux singleton at call time; the screen passes the version it already selects.
pushThreadRoom carried its own copy of the removed-thread branch and had drifted to `Thread`; the shared helper's `Message_removed` now wins for both call paths.
The handlers hook wired pushThreadRoom a second time without onCancel, so the loading overlay opened there had no cancel button. It now takes the screen's onThreadPress, and onReplyInit delegates to it instead of repeating the push.
The handlers hook built a second set of reaction actions over the same message action store; it now takes the ones the screen already created.
The answer-button handler duplicated the screen's send wiring; it now reuses it, and the send behaviour is covered on the service itself.
The provider forked into two components only to default timeFormat; the setting is now read unconditionally and used when the caller passes none.
pushThreadRoom is now the single owner of thread-name resolution and of both reply paths, and neither it nor the helper had a test.
useRoomInit exposes failed and retry so a room whose init exhausted its attempts no longer renders as an empty room.
useDebounce now returns DebouncedState so callers reach .cancel; the list onEndReached and the readThread timer no longer fire after unmount.
… cover logout in tests
… diegolmello/bug-routing-config-cache-no-retry
diegolmello
had a problem deploying
to
approve_e2e_testing
September 3, 2026 16:46 — with
GitHub Actions
Error
diegolmello
had a problem deploying
to
approve_e2e_testing
September 3, 2026 16:48 — with
GitHub Actions
Error
diegolmello
requested a deployment
to
android_build
September 3, 2026 16:50 — with
GitHub Actions
Waiting
diegolmello
had a problem deploying
to
ios_build
September 3, 2026 16:50 — with
GitHub Actions
Error
… diegolmello/bug-room-not-rewritten-on-last-message-flip
… diegolmello/bug-livechat-flags-stale-on-type-change
diegolmello
had a problem deploying
to
approve_e2e_testing
September 3, 2026 17:02 — with
GitHub Actions
Error
diegolmello
had a problem deploying
to
ios_build
September 3, 2026 17:04 — with
GitHub Actions
Error
diegolmello
had a problem deploying
to
android_build
September 3, 2026 17:04 — with
GitHub Actions
Error
Flatten the hook result so RoomScreen names every prop it passes instead of spreading consumer-shaped bundles, drop the explanatory comments, and keep room init ahead of the room subscription as before the split.
…icate unit tests Also moves visibleSystemMessages out of the hooks folder, since it exports no hooks.
… diegolmello/bug-hidden-system-messages-untested
diegolmello
had a problem deploying
to
approve_e2e_testing
September 3, 2026 17:28 — with
GitHub Actions
Error
… diegolmello/roomview-split-roomscreen # Conflicts: # app/views/RoomView/RoomScreen.tsx
diegolmello
had a problem deploying
to
approve_e2e_testing
September 3, 2026 17:31 — with
GitHub Actions
Error
… diegolmello/bug-routing-config-cache-no-retry
diegolmello
requested a deployment
to
approve_e2e_testing
September 3, 2026 17:33 — with
GitHub Actions
Waiting
diegolmello
requested a deployment
to
ios_build
September 3, 2026 17:35 — with
GitHub Actions
Waiting
diegolmello
requested a deployment
to
android_build
September 3, 2026 17:35 — with
GitHub Actions
Waiting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
Follow-up to #7482 with the first tier of RoomView simplifications. Stacked on
native-34-roomview-hooksso the migration and the cleanups can be reviewed separately.Performance
lastMessageFromAgentfromlast_messageinside the same observer to feed the on-hold permission.MessageComposerreads send-time values from the store inside the press handler instead of subscribing to five slices.useRoomStoreForScreenskips the extra render when the acquired store is unchanged.RightButtonsand room-actions mount. The on-hold permission is derived from the room store'slastMessageFromAgentand the omnichannel permissions live inuseOmnichannelPermissions.Bug fixes
onEndReachedandreadThreadare cancelled on unmount.useDebouncenow returns the debounced state so.cancelis typed.RoomViewpushed withoutridortrenders aRoom_not_foundscreen with a Back button instead of an empty room.One canonical wiring per behavior
fetchThreadName; a removed thread now titles asMessage_removed(wasThreadon one path).useReactionActionscall and onesendRoomMessagewiring per room screen, passed toRoomMessageProvideras room actions.MessageRoomStoreProvider/MessageRoomProviderWithSettingcollapsed into one provider.RoomPlaceholdershell shared byEncryptedRoom,MissingRoomE2EEKey,InvitedRoomand the newRoomLoadFailed.RoomGatebefore the room tree mounts; the invalid-route screen sits above the gate and the init-failure screen below it, insideRoomScreen.Mechanical
useMessages: DB clause is the only system-message filter, query clauses assembled in one literal, noQ.skip(0), thread record appended without an unconditional clone, shared newer-loader lookup withgetLocalAnchor, no double casts.Animated.FlatListandroomUpdateinstead of@ts-ignore/any.TakeOrJoin/OnHold; blank-label sentinel removed fromLeftButtons.actionit serves.Issue(s)
https://rocketchat.atlassian.net/browse/NATIVE-34
How to test or reproduce
Message_removed.RoomViewwithoutrid(for example a malformed deep link): the Room not found screen appears and Back returns to the previous screen.Screenshots
Types of changes
Checklist
Further comments
Not device-verified yet; unit suites, lint and the React Compiler contract test pass on every commit.
useE2EEStatusanduseRoomRemovedstill peek the store registry because they run above the store provider; moving the provider is left for a later PR, as are the remaining R2/R3/R5/R6 items.Summary by CodeRabbit
New Features
Bug Fixes
Tests