fix(community): refresh members list when a new agent joins#607
fix(community): refresh members list when a new agent joins#607HexaField wants to merge 1 commit into
Conversation
The neighbourhood members list was only fetched once in `useCommunityService.ts` (on mount), so newcomers stayed invisible until the user remounted the component (e.g. closed and reopened the members modal). Wire a watcher on the signalling service's `agents` map and refetch `getMembers()` the first time we see a DID we don't already have in `members.value`. The signalling service already tracks every agent that broadcasts a heartbeat (including the "first-broadcast" each agent sends on join), so this picks up new joiners reactively without polling and without changing any of the underlying ad4m primitives. The watcher is no-op while `membersLoading` is true (avoids a feedback loop on the first fetch) and is unregistered alongside the existing `link-added` listener in `cleanup()`.
✅ Deploy Preview for fluxsocial-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds automatic refetching of community members when the signalling service broadcasts from new DIDs. A computed property tracks current member DIDs, a watcher observes new signalling agents, and triggers a member refresh when needed while avoiding duplicate requests during ongoing loads. Cleanup properly stops the watcher to prevent lingering reactivity. ChangesAuto-refetch community members on signalling updates
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Summary
Members list in a neighbourhood didn't update when someone new joined — you had to remount the modal to see them. The community service was fetching
neighbourhood.otherAgents()once on mount and never refreshing.Fix
Watch the signalling service's
agentsmap and refetch `getMembers()` whenever a DID appears that we don't already have in `members`. The signalling service already tracks every agent that broadcasts a heartbeat (including the "first-broadcast" each agent sends on join), so this picks up new joiners reactively without polling and without changing any of the underlying ad4m primitives.Test plan
Summary by CodeRabbit