Conversation
…or / ContactItem) Polish PR following #377 and #378. SDK - Add useAdminPermissions(): focused subscription returning { isAdmin, hasUserCommands, canManageUser } only — for components that gate UI on admin rights without needing the full admin store (sessions, command queues, user/room lists, vhosts, pagination, etc.). - Extract USER_COMMANDS to a shared adminCommands.ts so useAdmin and useAdminPermissions share the source of truth. App - ContactItem (in ContactList): swap useAdmin() for useAdminPermissions(). Each row in the contact list previously subscribed to the full admin store. - ContactSelector: drop useChat() in favour of a focused useChatStore selector for conversations. Mounted inside several modals. - RoomConfigModal: drop useAdmin() in favour of a useCallback wrapper around client.admin.fetchRoomOptions via useXMPP(). Only one action was used; no need for the full admin subscription set. Tests updated for the new mock surface. Full suite passes.
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.
Polish PR following #377 and #378. Closes the remaining low-/medium-impact callers identified in the audit so that no live component pulls a full
useChat()/useRoom()/useAdmin()just for one or two values.SDK
useAdminPermissions()— focused subscription returning{ isAdmin, hasUserCommands, canManageUser }only. Avoids the ~15 admin store subscriptions thatuseAdmin()makes (sessions, command queues, user/room lists, vhosts, pagination…).USER_COMMANDSinto a sharedadminCommands.tssouseAdminanduseAdminPermissionsshare the source of truth.App
ContactList): swapuseAdmin()foruseAdminPermissions(). Each row previously had a full admin-store subscription, so any unrelated admin update re-rendered every contact in the list.CreateRoomModal,CreateQuickChatModal,InviteToRoomModal,RoomMembersModal): dropuseChat()in favour of a focuseduseChatStoreselector forconversations.useAdmin()in favour of auseCallbackwrapper aroundclient.admin.fetchRoomOptionsviauseXMPP(). OnlygetRoomOptionswas used.