Fetch friends list on chat page load to resolve friend name after refresh
This commit is contained in:
+5
-1
@@ -28,7 +28,7 @@ export default function Chat() {
|
||||
emitTyping,
|
||||
clearChat,
|
||||
} = useChatStore();
|
||||
const { friends } = useFriendsStore();
|
||||
const { friends, fetchFriends } = useFriendsStore();
|
||||
|
||||
const [input, setInput] = useState('');
|
||||
const [sending, setSending] = useState(false);
|
||||
@@ -62,6 +62,10 @@ export default function Chat() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (friends.length === 0) {
|
||||
fetchFriends();
|
||||
}
|
||||
|
||||
if (friendId) {
|
||||
connect();
|
||||
openConversation(friendId);
|
||||
|
||||
Reference in New Issue
Block a user