diff --git a/packages/react-native/src/views/ChatRoomView/ChatRoomView.js b/packages/react-native/src/views/ChatRoomView/ChatRoomView.js index 616156070..9aee840b3 100644 --- a/packages/react-native/src/views/ChatRoomView/ChatRoomView.js +++ b/packages/react-native/src/views/ChatRoomView/ChatRoomView.js @@ -4,7 +4,7 @@ import { ChatInput } from '../../components/ChatInput'; import { MessageActionsSheet } from '../../components/MessageActionsSheet'; import { MessageList } from '../../components/MessageList'; import { useRCContext } from '../../contexts/RCInstance'; -import { useMessageStore, useChannelStore, useUserStore } from '../../store'; +import { useMessageStore, useMemberStore, useUserStore } from '../../store'; const styles = StyleSheet.create({ container: { @@ -16,7 +16,7 @@ const ChatRoomView = () => { const { RCInstance, ECOptions } = useRCContext(); const isUserAuthenticated = useUserStore((state) => state.isUserAuthenticated); - const setMemberRoles = useChannelStore((state) => state.setMemberRoles); + const setMemberRoles = useMemberStore((state) => state.setMemberRoles); const setMessages = useMessageStore((state) => state.setMessages); const upsertMessage = useMessageStore((state) => state.upsertMessage); diff --git a/packages/react/src/hooks/useFetchChatData.js b/packages/react/src/hooks/useFetchChatData.js index ce0c4d1b6..6ddf46709 100644 --- a/packages/react/src/hooks/useFetchChatData.js +++ b/packages/react/src/hooks/useFetchChatData.js @@ -1,10 +1,15 @@ import { useCallback, useContext } from 'react'; import RCContext from '../context/RCInstance'; -import { useUserStore, useChannelStore, useMessageStore } from '../store'; +import { + useUserStore, + useChannelStore, + useMemberStore, + useMessageStore, +} from '../store'; const useFetchChatData = (showRoles) => { const { RCInstance, ECOptions } = useContext(RCContext); - const setMemberRoles = useChannelStore((state) => state.setMemberRoles); + const setMemberRoles = useMemberStore((state) => state.setMemberRoles); const isChannelPrivate = useChannelStore((state) => state.isChannelPrivate); const setMessages = useMessageStore((state) => state.setMessages); const isUserAuthenticated = useUserStore( diff --git a/packages/react/src/store/channelStore.js b/packages/react/src/store/channelStore.js index ce0bd21b1..d91bc7daa 100644 --- a/packages/react/src/store/channelStore.js +++ b/packages/react/src/store/channelStore.js @@ -3,8 +3,6 @@ import { create } from 'zustand'; const useChannelStore = create((set) => ({ showChannelinfo: false, isChannelPrivate: false, - memberRoles: {}, - setMemberRoles: (memberRoles) => set((state) => ({ ...state, memberRoles })), setShowChannelinfo: (showChannelinfo) => set(() => ({ showChannelinfo })), channelInfo: {}, setChannelInfo: (channelInfo) => set(() => ({ channelInfo })), diff --git a/packages/react/src/store/memberStore.js b/packages/react/src/store/memberStore.js index 3dc614bc9..b731bc1db 100644 --- a/packages/react/src/store/memberStore.js +++ b/packages/react/src/store/memberStore.js @@ -3,6 +3,8 @@ import { create } from 'zustand'; const useMemberStore = create((set) => ({ members: [], showMembers: false, + memberRoles: {}, + setMemberRoles: (memberRoles) => set((state) => ({ ...state, memberRoles })), toggleShowMembers: () => set((state) => ({ showMembers: !state.showMembers })), setMembersHandler: (memberList) => set(() => ({ members: memberList })),