fix: message sending fallback + iOS zoom on input + openOrCreatePrivate
- MessageInput: HTTP fallback when WebSocket not OPEN (prevents silent failures) - WsClient: add trySend() returning bool to detect WS availability - Backend: POST /api/messages/chat/:chatId endpoint for HTTP message send - openOrCreatePrivate: use openChat() for consistency after refreshing chat list - iOS fix: inputs get font-size:16px on mobile to prevent Safari auto-zoom Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -90,16 +90,19 @@ export default function MainLayout() {
|
||||
try {
|
||||
const { data: chatData } = await api.post(`/api/chats/private/${userId}`);
|
||||
setSearch('');
|
||||
// Load full chat detail directly by ID — don't rely on list lookup
|
||||
const { data: fullChatData } = await api.get(`/api/chats/${chatData.id}`);
|
||||
// Also refresh the sidebar chat list
|
||||
api.get('/api/chats').then(r => setChats(r.data)).catch(() => {});
|
||||
// Build chat object to open
|
||||
const chatToOpen = { ...fullChatData, id: chatData.id };
|
||||
setActiveChat(chatToOpen);
|
||||
setFullChat(chatToOpen);
|
||||
setMobileChatOpen(true);
|
||||
setShowInfo(false);
|
||||
const { data: allChats } = await api.get('/api/chats');
|
||||
setChats(allChats);
|
||||
const chatFromList = allChats.find((c: any) => c.id === chatData.id);
|
||||
if (chatFromList) {
|
||||
await openChat(chatFromList);
|
||||
} else {
|
||||
// fallback: open by direct API call
|
||||
const { data: fullChatData } = await api.get(`/api/chats/${chatData.id}`);
|
||||
setActiveChat(fullChatData);
|
||||
setFullChat(fullChatData);
|
||||
setMobileChatOpen(true);
|
||||
setShowInfo(false);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('openOrCreatePrivate:', e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user