fix(vscode): capture pending sandbox draft edits

This commit is contained in:
Marius
2026-06-25 10:33:30 +02:00
parent cbe29c64f7
commit 8047854400
2 changed files with 15 additions and 9 deletions
@@ -37,6 +37,19 @@ describe("PromptInput sandbox toggle", () => {
expect(toggle).not.toContain('type: "updateConfig"')
})
it("captures edits made while sandbox session creation is pending", () => {
const start = src.indexOf('if (message.type === "sessionCreated")')
const end = src.indexOf('if (message.type === "action"', start)
const created = src.slice(start, end)
const save = created.indexOf("if (source === draftKey()) saveDraft(source, text(), reviewComments(), imageAttach.images())")
const move = created.indexOf("movePromptDraft(")
expect(start).toBeGreaterThan(-1)
expect(end).toBeGreaterThan(start)
expect(save).toBeGreaterThan(-1)
expect(move).toBeGreaterThan(save)
})
it("keeps success feedback out of the webview toast region", () => {
const start = src.indexOf("const handleSandboxMessage =")
const end = src.indexOf("const unsubscribe =", start)
@@ -568,15 +568,8 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
if (raw) {
const source = scopeDraftKey(boxKey(), raw)
const target = scopeDraftKey(boxKey(), sessionDraftKey(message.session.id))
const draft = movePromptDraft({ text: drafts, comments: reviewDrafts, images: imageDrafts }, source, target)
if (
draft.text === undefined &&
draft.comments === undefined &&
draft.images === undefined &&
source === draftKey()
) {
saveDraft(target, text(), reviewComments(), imageAttach.images())
}
if (source === draftKey()) saveDraft(source, text(), reviewComments(), imageAttach.images())
movePromptDraft({ text: drafts, comments: reviewDrafts, images: imageDrafts }, source, target)
}
if (
message.draftID &&