Repository navigation
perf: resolve member names with one getUsersByIds call - #97
Merged
Merged
Conversation
groups view, channel members, and conversation view fired one getUserById per member in parallel. Resolve them with a single batched getUsersByIds call instead; unresolvable members still fall back to user:<id>. Allow the new read method in read-only mode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
amix
marked this pull request as ready for review
November 1, 2026 18:44
doistbot
reviewed
Nov 1, 2026
doistbot
left a comment
Member
There was a problem hiding this comment.
This PR replaces N parallel getUserById calls with a single batched getUsersByIds lookup in groups view, channel members, and conversation view, preserving the user:<id> fallback for unresolvable members and adding the new method to the read-only allowlist and spinner map.
Few things worth tightening:
- SDK bump is required before merging:
package.jsonand the lockfile still pin@doist/comms-sdkto 3.9.1, so clean installs fail type-check/build, and the missing method would throw at runtime before the.catch()fallback can kick in. Update both to the release containinggetUsersByIds. - Duplicated fallback logic: the tolerant
getUsersByIds(...).catch(() => ({}))+ null-filtering pattern now appears three times (groups view, channel membership helpers, conversation view). Consider extracting a shared helper insrc/lib/api.ts(e.g. next tobuildUserNameMap) so the fallback and unresolved-member behavior live in one place. - Minor:
conversation viewno longer dedupes user IDs before the batch call, so repeated participant IDs get sent in the same request.
I also included a few optional follow-up notes in the details below.
Optional follow-up notes (3)
src/commands/conversation/view.ts:18: The previous implementation deduped with
new Setbefore looking users up, but this now passes[...userIds]as-is. Forconversation view,userIdsis built fromconversation.userIdsplus every message creator, so participants who authored messages appear many times and are sent repeatedly in the batch. Keep the dedupe:userIds: [...new Set(userIds)].src/commands/groups/groups.test.ts:255: This test no longer exercises the batch-rejection fallback. The previous mock made the lookup throw, which covered
viewGroup's.catch(() => ({}))path; the new mixed response only covers a null entry for one member. IfgetUsersByIdsrejects, every member should still fall back touser:<id>(JSON:name: null), but nogroups viewtest would catch a regression there. Add a rejection case asserting the fallback for all members.src/commands/channel/members.test.ts:60: The default mock changed from throwing for unknown ids to returning
{ id: null }, so the existingfalls back to user:<id> for unknown memberstest now exercises the null-entry branch instead offetchUsersByIds's.catch(() => ({}))branch. A rejectedgetUsersByIdscall is a distinct fallback path and is now untested in this suite. Add one rejection case asserting all members fall back.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Posted by Claudex on behalf of Amir: Doistbot's other notes:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
doist-release-bot Bot
added a commit
that referenced
this pull request
Nov 2, 2026
## [3.8.2](v3.8.1...v3.8.2) (2026-11-02) ### Performance Improvements * resolve member names with one getUsersByIds call ([#97](#97)) ([ee7c93e](ee7c93e))
Contributor
|
🎉 This PR is included in version 3.8.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
scottlovegrove
approved these changes
Nov 2, 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.
Context
groups view,channel membersandconversation viewfire onegetUserByIdper member in parallel.undicicalls toworkspace_users/getonerun at ~320ms p50, versus ~25ms from browsers. One batched request replaces N.getUsersByIdsshipped in@doist/comms-sdk3.11.0 (feat: add getUsersByIds for batched workspace user lookups comms-sdk-typescript#125).What was changed
getUsersByIdscall. Unresolvable members, or a failed lookup, still fall back touser:<id>.workspaceUsers.getUsersByIdsis allowed in read-only mode and has a spinner label.groups viewandchannel memberseach cover both an unresolved member and a rejected batch.@doist/comms-sdk3.9.1 → 3.11.0. The lockfile changes only the SDK and its own pinned dependencies.Out of scope
msg view,comment view,conversation with).🤖 Generated with Claude Code