Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

perf(community): lazy-fetch channel addable-members only while the add dialog is open

Shelly634a6cf4b938
diff --git a/src/web/src/app/c/channels/[serverId]/[channelId]/page.tsx b/src/web/src/app/c/channels/[serverId]/[channelId]/page.tsx
index 142313b21..89accbe07 100644
--- a/src/web/src/app/c/channels/[serverId]/[channelId]/page.tsx
+++ b/src/web/src/app/c/channels/[serverId]/[channelId]/page.tsx
@@ -167,7 +167,15 @@ function ChannelView() {
const removeThreadParticipantMut = useRemoveThreadParticipant(channelId)
const addThreadParticipantMut = useAddThreadParticipant(channelId)
// Top-level channel/forum add-picker source + mutations (add: any member).
- const addableChannelMembers = useAddableMembers(channelId, currentChannelPrivate && !isNotifyUnit)
+ // W-LAZY (necessity plan): the addable-members list feeds ONLY the "add
+ // members" dialog, so fetch it only while that dialog is open — not eagerly
+ // on channel open. `manageMembersOpen` gates both the dialog's render and
+ // this fetch, so opening the dialog triggers the fetch and a plain channel
+ // switch never does.
+ const addableChannelMembers = useAddableMembers(
+ channelId,
+ manageMembersOpen && currentChannelPrivate && !isNotifyUnit,
+ )
const addChannelMemberMut = useAddChannelMember(channelId)
const removeChannelMemberMut = useRemoveChannelMember(channelId)
// Notify-unit add-picker source = the parent channel/forum's roster (minus