From 7d5df5f0161b8a46d5dd6a58f78c08d271c50b2c Mon Sep 17 00:00:00 2001 From: ciregenz Date: Thu, 11 Jun 2026 03:42:57 -0700 Subject: [PATCH] [eric] app-builder: seed initialDraftId from the existing session so a warm reopen renders the chat instantly (no Initializing-agent blank frame) --- frontend/src/app/pages/Views/ViewEditor.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/pages/Views/ViewEditor.tsx b/frontend/src/app/pages/Views/ViewEditor.tsx index 67c7feee..e6718d16 100644 --- a/frontend/src/app/pages/Views/ViewEditor.tsx +++ b/frontend/src/app/pages/Views/ViewEditor.tsx @@ -373,7 +373,11 @@ const ViewEditor: React.FC = ({ output }) => { document.body.style.userSelect = ''; }, []); - const [initialDraftId, setInitialDraftId] = useState(null); + // Seed from the existing session id so a warm reopen resolves effectiveSessionId + // on the FIRST render (no "Initializing agent..." blank frame while the mount + // effect re-derives it). Cold opens still read null until fetchSession lands, + // because the selector requires the session to actually be in the store. + const [initialDraftId, setInitialDraftId] = useState(output?.session_id ?? null); const [workspacePath, setWorkspacePath] = useState(null); // Reuse the Output's workspace_id across remounts so we don't orphan agent edits or chat history. const [stableWorkspaceId] = useState(() => output?.workspace_id || `ws-${Date.now().toString(36)}`);