fix(watermelon): prevent room list query flicker on connection status change#7439
fix(watermelon): prevent room list query flicker on connection status change#7439Shevilll wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📜 Recent review details🧰 Additional context used📓 Path-based instructions (5)**/*.{js,ts,jsx,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{js,jsx,ts,tsx,json}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{js,jsx,ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
app/views/**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (1)📚 Learning: 2026-04-30T17:07:51.020ZApplied to files:
🔇 Additional comments (1)
WalkthroughThe rooms subscription hook now depends on the nested server value instead of the full server Redux object, changing when the WatermelonDB subscription effect re-runs. ChangesRooms list subscription dependency
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 (1)
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 |
Problem
In
useSubscriptions.ts, theserverstate was retrieved usingconst server = useAppSelector(state => state.server);.Since the
state.serverobject contains several properties including the connection status (loading,connecting, etc.), any transition in connection state (e.g., fromconnectingtoconnected) triggers a state update. This state update causesuseSubscriptionsto re-evaluate, triggering a complete re-query of WatermelonDB for the list of rooms, which results in a highly visible and disruptive UX flicker.Solution
We restrict the selector dependency to only track
state.server.server(the actual server URL). This ensures that simple connection status transitions (which do not change the active server URL) do not trigger unnecessary WatermelonDB queries or UI flickers.Closes #7093
Summary by CodeRabbit