From c10cdcf2e5f5011baae479f893fef6b8d598d6d6 Mon Sep 17 00:00:00 2001 From: hzhang Date: Fri, 15 May 2026 08:52:25 +0100 Subject: [PATCH] fix(frontend): create channel under selected guild and surface errors via modal - createChannel falls back to selectedGuildId when guildDbId is unknown, so the first channel of a guild can be created (no chicken-and-egg) - channel is created under the currently selected guild - errors now show in a dismissible modal instead of the Messages pane Co-Authored-By: Claude Opus 4.7 (1M context) --- src/pages/ChatPage.tsx | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/pages/ChatPage.tsx b/src/pages/ChatPage.tsx index 9f1d41c..c5ce19f 100644 --- a/src/pages/ChatPage.tsx +++ b/src/pages/ChatPage.tsx @@ -143,15 +143,16 @@ export default function ChatPage() { async function createChannel() { if (!guild || !guildToken || !newChannelName.trim()) return - if (!guildDbId) { - setError('Cannot create channel: guildId is missing') + const effectiveGuildId = guildDbId || selectedGuildId + if (!effectiveGuildId) { + setError('Cannot create channel: no guild selected') return } setError('') try { const payload = { name: newChannelName.trim(), - guildId: guildDbId, + guildId: effectiveGuildId, memberUserIds: selectedMemberIds, } const res = await guildApi().post('/channels', payload) @@ -242,7 +243,6 @@ export default function ChatPage() {

Messages

{loading ?

Loading...

: null} - {error ?

{error}

: null}
    {messages.map((m) => (
  • @@ -298,6 +298,18 @@ export default function ChatPage() {
) : null} + + {error ? ( +
setError('')}> +
e.stopPropagation()}> +

Error

+

{error}

+
+ +
+
+
+ ) : null} ) }