fix: private chat creation and search in NewChatModal
- Fix: onOpen now async, MainLayout fetches fresh chats before opening (was using stale closure, chat wasn't found after creation) - Fix: search null-safety in user list filter (displayName/username could be undefined) - Fix: search also matches by phone number Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -246,9 +246,13 @@ export default function MainLayout() {
|
||||
</div>
|
||||
|
||||
{/* Modals */}
|
||||
{showNew && <NewChatModal onClose={() => setShowNew(false)} onOpen={(id) => {
|
||||
const chat = chats.find(c => c.id === id);
|
||||
if (chat) openChat(chat);
|
||||
{showNew && <NewChatModal onClose={() => setShowNew(false)} onOpen={async (id) => {
|
||||
try {
|
||||
const { data: allChats } = await api.get('/api/chats');
|
||||
setChats(allChats);
|
||||
const found = allChats.find((c: any) => c.id === id);
|
||||
if (found) openChat(found);
|
||||
} catch {}
|
||||
}} />}
|
||||
{showAdmin && <AdminPanel onClose={() => setShowAdmin(false)} />}
|
||||
{showProfile && <ProfileModal onClose={() => setShowProfile(false)} />}
|
||||
|
||||
Reference in New Issue
Block a user