fix: await draft deletion through the card facade (#405)

Issue: #405
User-Visible: no
This commit is contained in:
Sergey Matyunin
2026-09-01 22:23:57 +03:00
parent e926ea453e
commit b4809a12ff
25 changed files with 240 additions and 155 deletions
+3 -2
View File
@@ -218,8 +218,9 @@ export class EditorSecondaryController {
};
}
runContext(capturedContext: string, currentContext: string, action: () => void): void {
if (capturedContext === currentContext) action();
runContext<T>(capturedContext: string, currentContext: string, action: () => T): T | undefined {
if (capturedContext === currentContext) return action();
return undefined;
}
render(model: EditorSecondaryModel | null, blocked: boolean): TemplateResult {
+2 -2
View File
@@ -7894,7 +7894,7 @@ export class HouseplanCard extends LitElement {
return this._editorRuntimeOrThrow()._savePhysicalDialog();
}
private _deletePhysicalSelection = (): void => {
private _deletePhysicalSelection = (): Promise<void> => {
return this._editorRuntimeOrThrow()._deletePhysicalSelection();
}
@@ -8926,7 +8926,7 @@ export class HouseplanCard extends LitElement {
return `${base}:none`;
}
private _runEditorContext(contextId: string, action: () => void): void {
private _runEditorContext<T>(contextId: string, action: () => T): T | undefined {
return this._editorRuntimeOrThrow()._runEditorContext(contextId, action);
}
+6 -4
View File
@@ -3070,11 +3070,11 @@ public _savePhysicalDialog = (): void => {
if (!committed) this.host.requestUpdate();
};
public _deletePhysicalSelection = (): void => {
public _deletePhysicalSelection = async (): Promise<void> => {
const sel = this.host._physicalSel;
const sp = this.host._curSpaceCfg as any;
if (!sel || !sp) return;
if (sel.kind === 'draft') { this._deleteDraftWhole(); return; }
if (sel.kind === 'draft') { await this._deleteDraftWhole(); return; }
const before = this._geometrySnapshot();
if (sel.kind === 'partition') {
const hosted = (sp.openings || [])
@@ -5287,8 +5287,10 @@ public _renderEditorGroupLauncher(group: EditorToolbarGroup): TemplateResult {
);
}
public _runEditorContext(contextId: string, action: () => void): void {
this.host._editorSecondary.runContext(contextId, this.host._editorSecondaryContextId, action);
public _runEditorContext<T>(contextId: string, action: () => T): T | undefined {
return this.host._editorSecondary.runContext(
contextId, this.host._editorSecondaryContextId, action,
);
}
public _renderEditorGroupModel(group: EditorToolbarGroup): EditorSecondaryModel {