Skip to content

Commit db9cc56

Browse files
Yuruzuuclaude
andcommitted
fix(web): closing an archived side chat keeps its draft
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 5d7b326 commit db9cc56

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

‎apps/web/src/hooks/useRightPanelSurfaceClose.browser.test.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ it.each([
162162
{ name: "the delete fails", threadRemoved: true, failDelete: true, cleared: false },
163163
{ name: "the shell is not live", threadRemoved: true, shellStatus: "loading", cleared: false },
164164
{
165-
name: "it was deleted before closing",
165+
name: "it already left the live shell, as an archived one does",
166166
sideChatShell: null,
167167
threadRemoved: false,
168-
cleared: true,
168+
cleared: false,
169169
},
170170
])(
171171
"clears a closed side chat's draft only after deletion: $name",

‎apps/web/src/hooks/useRightPanelSurfaceClose.ts‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,8 @@ export function useRightPanelSurfaceClose(input: {
7575
const sideChatRef = scopeThreadRef(ref.environmentId, surface.threadId);
7676
const shellIsLive = () =>
7777
appAtomRegistry.get(environmentShell.stateValueAtom(ref.environmentId)).status === "live";
78-
// A live shell without the side chat means it is already deleted.
79-
if (shellIsLive() && readThreadShell(sideChatRef) === null) {
80-
useComposerDraftStore.getState().clearDraftThread(sideChatRef);
81-
return;
82-
}
78+
// Deleting and archiving both drop it from the live shell; an archived draft must survive.
79+
if (shellIsLive() && readThreadShell(sideChatRef) === null) return;
8380
if (!readEnvironmentScope(ref.environmentId, AuthOrchestrationOperateScope)) return;
8481
// The server keeps a side chat with a run or message. Reopen skips one it deleted.
8582
void deleteThread({

0 commit comments

Comments
 (0)