- {status === "done" && (
-
- )}
{(showOutput || status === "running") && (
-
+ {!richHtml && }
{(attachmentInfo.message || richHtml) && (
void;
+ /** Hide the header action buttons (when they're rendered elsewhere, e.g. tab bar). */
+ hideHeaderActions?: boolean;
};
export const ChatPanel = forwardRef
(
@@ -834,6 +835,7 @@ export const ChatPanel = forwardRef(
subagentTask,
subagentLabel,
onBack,
+ hideHeaderActions,
},
ref,
) {
@@ -853,6 +855,9 @@ export const ChatPanel = forwardRef(
const [showFilePicker, setShowFilePicker] =
useState(false);
+ const [mounted, setMounted] = useState(false);
+ useEffect(() => { setMounted(true); }, []);
+
// ── Reconnection state ──
const [isReconnecting, setIsReconnecting] = useState(false);
const reconnectAbortRef = useRef(null);
@@ -881,10 +886,13 @@ export const ChatPanel = forwardRef(
const [rawView, _setRawView] = useState(false);
// ── Hero state (new chat screen) ──
- const [greeting, setGreeting] = useState("");
- const [visiblePrompts, setVisiblePrompts] = useState([]);
+ const [greeting, setGreeting] = useState("How can I help?");
+ const [visiblePrompts, setVisiblePrompts] = useState(PROMPT_SUGGESTIONS.slice(0, 7));
+ const heroInitRef = useRef(false);
useEffect(() => {
+ if (heroInitRef.current) return;
+ heroInitRef.current = true;
const greetings = [
"Ready to build?",
"Let's automate something?",
@@ -901,9 +909,6 @@ export const ChatPanel = forwardRef(
};
const allGreetings = [getTimeGreeting(), ...greetings];
setGreeting(allGreetings[Math.floor(Math.random() * allGreetings.length)]);
- }, []);
-
- useEffect(() => {
const shuffled = [...PROMPT_SUGGESTIONS].sort(() => 0.5 - Math.random());
setVisiblePrompts(shuffled.slice(0, 7));
}, []);
@@ -1683,7 +1688,10 @@ export const ChatPanel = forwardRef(
`/api/web-sessions/${sessionId}`,
);
if (!response.ok) {
- throw new Error("Failed to load session");
+ console.warn(`Session ${sessionId} not found (${response.status}), starting fresh.`);
+ setMessages([]);
+ setLoadingSession(false);
+ return;
}
const data = await response.json();
@@ -2059,7 +2067,7 @@ export const ChatPanel = forwardRef(
)}
- {isStreaming && (
+ {isStreaming ? (
- )}
- {isStreaming ? (
-
) : (