Repository navigation
fix(desktop): push new members and profile edits to pickers live - #65
Merged
Merged
Conversation
A member who joined mid-session never appeared in the DM recipient picker
until the app restarted. Nothing on desktop subscribed to kind:0, and the
only kind:13534 live subscription ran for owners/admins and fed only the
members panel, so the user-search, users-batch, user-profile and
membership caches never learned that fresh data had landed.
useLiveDirectoryUpdates keeps one live {kinds:[0,13534]} subscription on
the app's relay socket:
- kind:0 evicts that member's users-batch entry and refreshes user-search
(infinite queries trimmed to page one), user-profile and users-batch,
once per 2s window that a burst cannot postpone;
- kind:13534 writes the roster straight into relayMembers (created_at
fenced) and refetches the viewer's own membership only when their role
changed;
- a failed subscribe retries with backoff instead of freezing the
directory until restart.
Reconnect auto-heal now also refreshes myRelayMembershipLookup.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: QuicksilverSlick <russelledeming@gmail.com>
This was referenced Oct 22, 2026
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.
What happened
On 21 Oct a new identity claimed an invite on the hosted relay and published its kind:0 profile. The owner's running desktop did not show them in the DM recipient picker until the app was fully restarted.
Root cause
useCommunityJoinAlerts) runs for owners/admins only, and it writes only the members-panel cache.user-search(DM picker, @mention, member pickers, top-bar people search),users-batch/user-profile(author labels) and the viewer's own membership.user-searchis fresh for 30 s and app-focus refetch is off. An open picker, or one reopened within 30 s, kept serving the old directory.block/buzzhas no fix for this.Change
New
desktop/src/features/profile/useLiveDirectoryUpdates.ts, mounted once inAppShell(per community). It opens one live{kinds:[0,13534], limit:0}subscription on the existing relay socket.users-batch-entry;user-search, plus that member'suser-profileandusers-batch;POST /query(about 5/s, shared with every other read).relayMembers, using the same parser aslistRelayMembers, so it costs no request;created_at;myRelayMembership/myRelayMembershipLookuponly when the viewer's own role changed, so promotion or demotion applies without a reload.useRelayAutoHealhandles these. It now also refreshesmyRelayMembershipLookup, which was missing fromRELAY_QUERY_ROOTS.Testing
useLiveDirectoryUpdates.test.mjs(8 cases) drives the production function with a fake socket and a real QueryClient. I removed each guard in turn and a test failed every time: case normalisation, eviction, page trim, the fixed window, the roster fence, the own-role check, retry, and dispose.tests/e2e/live-directory.spec.ts(added to smoke). The DM picker is open on "Quill" with no match, the mock relay live-publishes a kind:0, and the person must appear with no reload. It fails when the hook is not mounted. A new mock-bridge seam,__BUZZ_E2E_EMIT_MOCK_PROFILE__, drives it.pnpm test: 7,123 + 177 passing.tsc --noEmit, biome andcheck:file-sizesare clean.live-directoryandmention-recipients(26 tests) pass. A wider batch also passed: channels, messaging, community-rail, agent-control-regressions, dm-history-live-regression and mock-subscription-readiness (216 passed).community-rail.spec.ts:815;messaging.spec.ts:1771(clipboard read permission).Not exercised: the native app against the hosted relay with a second real identity joining. The Playwright run covers the web build against the mock relay socket.
Follow-ups (not in this PR)
updateCachedChannelMemberDisplayNamecould take the name from the kind:0.users-batch-entry, so a label edited during a socket gap can stay stale for up to 10 minutes. This is marked with aponytail:comment.profilequery.🤖 Generated with Claude Code