app/views/RoomsListView/hooks/useSubscriptions.ts selects the entire server Redux object as a useEffect dependency:
const server = useAppSelector(state => state.server);
}, [isGrouping, sortBy, useRealName, showUnread, showFavorites, groupByType, roles, server]);
Since Redux reducers return a new object reference on every dispatch (even when only connecting or loading fields change), the useEffect fires on every server connection lifecycle transition — not just when the actual server URL changes.
Each spurious fire:
- Calls
setLoading(true) — rooms list blanks out
- Unsubscribes the existing WatermelonDB observable
- Creates and subscribes a brand new observable
Steps to Reproduce
- Open the app on a slow or unstable network
- Watch the rooms list — it briefly flickers/shows a loading spinner multiple times even after rooms have already loaded
- Or: toggle airplane mode off → observe rooms list reload multiple times in quick succession
Expected Behavior
The WatermelonDB subscription should only be recreated when the server URL actually changes (i.e. user switches servers). Connection state transitions like connecting: true → false or loading: true → false should not cause the rooms list to re-query.
Actual Behavior
The useEffect fires 4 times during a single reconnection cycle, even though the server URL never changes. Each fire triggers a full WatermelonDB resubscribe and a setLoading(true) flash.
Rocket.Chat Server Version
Not applicable — this is a client-side bug
Rocket.Chat App Version
Latest main branch
Device Name
Any
OS Version
Any (iOS and Android)
app/views/RoomsListView/hooks/useSubscriptions.tsselects the entireserverRedux object as auseEffectdependency:Since Redux reducers return a new object reference on every dispatch (even when only
connectingorloadingfields change), theuseEffectfires on every server connection lifecycle transition — not just when the actual server URL changes.Each spurious fire:
setLoading(true)— rooms list blanks outSteps to Reproduce
Expected Behavior
The WatermelonDB subscription should only be recreated when the server URL actually changes (i.e. user switches servers). Connection state transitions like
connecting: true → falseorloading: true → falseshould not cause the rooms list to re-query.Actual Behavior
The
useEffectfires 4 times during a single reconnection cycle, even though the server URL never changes. Each fire triggers a full WatermelonDB resubscribe and asetLoading(true)flash.Rocket.Chat Server Version
Not applicable — this is a client-side bug
Rocket.Chat App Version
Latest main branch
Device Name
Any
OS Version
Any (iOS and Android)