Skip to content

Commit

Permalink
fixed review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
thesynthax committed Mar 22, 2024
1 parent 3c45257 commit 9307360
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/react-native/src/views/ChatRoomView/ChatRoomView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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);
Expand Down
9 changes: 7 additions & 2 deletions packages/react/src/hooks/useFetchChatData.js
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
2 changes: 0 additions & 2 deletions packages/react/src/store/channelStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })),
Expand Down
2 changes: 2 additions & 0 deletions packages/react/src/store/memberStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })),
Expand Down

0 comments on commit 9307360

Please sign in to comment.