From ada648b0c5158d9ba560c20872d3d1ac1cc9a9da Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 12 Jan 2026 13:02:58 +0000 Subject: [PATCH] fix: handle missing protocol gracefully in ChatViewer --- src/components/ChatViewer.tsx | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/components/ChatViewer.tsx b/src/components/ChatViewer.tsx index 11f8424..ebe0740 100644 --- a/src/components/ChatViewer.tsx +++ b/src/components/ChatViewer.tsx @@ -294,7 +294,27 @@ export function ChatViewer({ const { searchEmojis } = useEmojiSearch(); // Get the appropriate adapter for this protocol - const adapter = useMemo(() => getAdapter(protocol), [protocol]); + const adapter = useMemo(() => { + if (!protocol) { + return null; + } + return getAdapter(protocol); + }, [protocol]); + + // Handle missing protocol + if (!protocol || !adapter) { + return ( +
+
+

Invalid chat configuration

+

+ Missing protocol. Please use the chat command with a valid + identifier. +

+
+
+ ); + } // Resolve conversation from identifier (async operation) const conversation = use$(