Skip to content

fix(community): refresh members list when a new agent joins#607

Open
HexaField wants to merge 1 commit into
devfrom
fix/members-list-subscription
Open

fix(community): refresh members list when a new agent joins#607
HexaField wants to merge 1 commit into
devfrom
fix/members-list-subscription

Conversation

@HexaField

@HexaField HexaField commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

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 agents map 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.

  • No-op while `membersLoading` is true (avoids a feedback loop on the initial fetch)
  • Watcher is unregistered alongside the existing `link-added` listener in `cleanup()`
  • Single touchpoint in `app/src/composables/useCommunityService.ts`

Test plan

  • `vue-tsc --noEmit` clean for the changed file (same set of pre-existing errors as dev — none introduced)
  • Manual: two ad4m agents on the same neighbourhood, second agent joins after first has the members modal open → second agent appears without manual refresh
  • Manual: ensure no regression in member-list pagination / search inside MembersModal

Summary by CodeRabbit

  • Bug Fixes
    • Community members list now automatically refreshes in real-time when new members become available, ensuring your roster stays current without manual intervention.

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()`.
@netlify

netlify Bot commented Jun 11, 2026

Copy link
Copy Markdown

Deploy Preview for fluxsocial-dev ready!

Name Link
🔨 Latest commit f6c41b1
🔍 Latest deploy log https://app.netlify.com/projects/fluxsocial-dev/deploys/6a2a71e43684160008fbf14a
😎 Deploy Preview https://deploy-preview-607--fluxsocial-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c68ca011-7e39-4179-878d-d9a63951cb8d

📥 Commits

Reviewing files that changed from the base of the PR and between bc3bae2 and f6c41b1.

📒 Files selected for processing (1)
  • app/src/composables/useCommunityService.ts

📝 Walkthrough

Walkthrough

This 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.

Changes

Auto-refetch community members on signalling updates

Layer / File(s) Summary
Auto-refetch members on new signalling DIDs
app/src/composables/useCommunityService.ts
Adds a reactive watcher on signallingService.agents keys that triggers getMembers() when new DIDs appear (skipping refetch while members are loading), and extends the cleanup function to stop the watcher on service teardown.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • coasys/flux#532: Both PRs modify app/src/composables/useCommunityService.ts by affecting getMembers(); this PR triggers it on new signalling DIDs while the retrieved PR deduplicates DIDs in the fetched output—refetch logic and output deduping work together.

Suggested reviewers

  • lucksus

Poem

🐰 When signals broadcast far and wide,
The members list must coincide,
A watcher springs to life with glee,
To fetch and sync community!
Then cleanup sweeps the watchers clean,
The tidiest refetch you've seen. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(community): refresh members list when a new agent joins' clearly and specifically describes the main change: automatically updating the members list when agents join the community.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/members-list-subscription

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 and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant