Skip to content

Commit 7f04b95

Browse files
committed
fix(web): clear an archived thread's drafts once when it is deleted
The archived-thread delete path cleared the thread's draft and uploads in the side chat loop and again from the merged #29164 change. Keep the loop, keep the terminal state clear, and assert the exact cleanup list.
1 parent 622b02d commit 7f04b95

2 files changed

Lines changed: 5 additions & 13 deletions

File tree

‎apps/web/src/hooks/useThreadActions.permissions.test.ts‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -359,21 +359,15 @@ describe("thread action permissions", () => {
359359
expect(state.requests).toEqual([
360360
expect.objectContaining({ action: "delete", environmentId: secondary }),
361361
]);
362+
expect(threadPanelStatePresence(target)).toEqual(panelStateCleared);
362363
expect(state.localEffects).toEqual([
364+
"release-uploads:thread",
365+
"clear-draft:thread",
366+
"release-uploads:side-chat",
367+
"clear-draft:side-chat",
363368
"refresh-archive",
364-
"release-uploads",
365-
"clear-draft",
366369
"clear-terminal-ui",
367370
]);
368-
expect(threadPanelStatePresence(target)).toEqual(panelStateCleared);
369-
expect(state.localEffects).toEqual(
370-
expect.arrayContaining([
371-
"release-uploads:thread",
372-
"clear-draft:thread",
373-
"release-uploads:side-chat",
374-
"clear-draft:side-chat",
375-
]),
376-
);
377371
expect(state.localEffects).not.toContain("clear-draft:fork");
378372
expect(state.localEffects).not.toContain("clear-draft:other-side-chat");
379373

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,6 @@ export function useThreadActions() {
477477
}
478478
expireThreadUndos(target, [...LIST_PLACEMENT_UNDO_KINDS, "archive"]);
479479
refreshArchivedThreadsForEnvironment(target.environmentId);
480-
releaseComposerDraftUploads(target);
481-
clearComposerDraftForThread(target);
482480
clearTerminalUiState(target);
483481
clearDeletedThreadPanelState(target);
484482
}

0 commit comments

Comments
 (0)