fix mini app bot father
This commit is contained in:
@@ -365,10 +365,17 @@ export function FamilyGroupView({ groupId }: { groupId: string }) {
|
||||
const loadMessages = useCallback(async (roomId: string) => {
|
||||
if (!token || isPinLocked) return;
|
||||
const room = rooms.find((item) => item.id === roomId);
|
||||
if (room?.type === 'BOT') return;
|
||||
const response = await fetchChatMessages(roomId, token);
|
||||
setMessages((response.messages ?? []).filter((message) => !message.isDeleted));
|
||||
}, [isPinLocked, rooms, token]);
|
||||
if (!room || room.type === 'BOT') return;
|
||||
try {
|
||||
const response = await fetchChatMessages(roomId, token);
|
||||
setMessages((response.messages ?? []).filter((message) => !message.isDeleted));
|
||||
} catch (error) {
|
||||
const message = getApiErrorMessage(error, 'Не удалось загрузить сообщения');
|
||||
if (message && !message.includes('Bot API')) {
|
||||
showToast(message);
|
||||
}
|
||||
}
|
||||
}, [isPinLocked, rooms, showToast, token]);
|
||||
|
||||
const loadPresence = useCallback(async () => {
|
||||
if (!token || isPinLocked) return;
|
||||
@@ -406,10 +413,11 @@ export function FamilyGroupView({ groupId }: { groupId: string }) {
|
||||
|
||||
useEffect(() => {
|
||||
if (!activeRoomId || activeRoomIsBot) return;
|
||||
if (!rooms.some((room) => room.id === activeRoomId)) return;
|
||||
void loadMessages(activeRoomId);
|
||||
setEditingMessageId(null);
|
||||
setDraft('');
|
||||
}, [activeRoomId, activeRoomIsBot, loadMessages]);
|
||||
}, [activeRoomId, activeRoomIsBot, loadMessages, rooms]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!activeRoomId || !token || !messages.length) return;
|
||||
|
||||
Reference in New Issue
Block a user