mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
fix: finalize late closed-pane attachments
This commit is contained in:
@@ -107,9 +107,12 @@ describe("staged chat attachment pane handoff", () => {
|
||||
);
|
||||
|
||||
closePaneStagedAttachments(pane.context, root, layout, pane.paneId);
|
||||
const lateAttachment = storedAttachment("late-close-completion");
|
||||
current.chatAttachments.push(lateAttachment);
|
||||
pane.disconnectedCallback();
|
||||
|
||||
expect(getChatAttachmentDataUrl(fallback)).toBeNull();
|
||||
expect(getChatAttachmentDataUrl(lateAttachment)).toBeNull();
|
||||
expect(
|
||||
pane.context.chatAttachmentHandoff.consume({
|
||||
owner,
|
||||
|
||||
@@ -670,13 +670,19 @@ export abstract class ChatPaneLifecycle extends ChatPaneBoard {
|
||||
}
|
||||
|
||||
override disconnectedCallback() {
|
||||
if (this.state && !this.suppressStagedAttachmentHandoffOnDisconnect) {
|
||||
preparePaneStagedAttachments(
|
||||
this.context,
|
||||
this.paneId,
|
||||
this.state,
|
||||
this.stagedAttachmentGatewayOwner,
|
||||
);
|
||||
if (this.state) {
|
||||
if (this.suppressStagedAttachmentHandoffOnDisconnect) {
|
||||
// MCP app teardown can delay DOM removal after pane close. Finalize any
|
||||
// attachment that completed during that delay instead of leaking it.
|
||||
discardStateStagedAttachments(this.state);
|
||||
} else {
|
||||
preparePaneStagedAttachments(
|
||||
this.context,
|
||||
this.paneId,
|
||||
this.state,
|
||||
this.stagedAttachmentGatewayOwner,
|
||||
);
|
||||
}
|
||||
}
|
||||
this.stagedAttachmentGatewayOwner = null;
|
||||
this.clearComposerPrefillAttention();
|
||||
|
||||
Reference in New Issue
Block a user