Skip to content

Commit 8033c21

Browse files
committed
patch(editing): actually wait for doc (openscd#879)
This quick patch actually fixes issue openscd#879 by including a crucial await that was still needed in the editor-action event handler before firing the ValidateEvent.
1 parent eb22280 commit 8033c21

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Editing.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ export function Editing<TBase extends LitElementConstructor>(Base: TBase) {
404404
else if (isUpdate(action)) this.logUpdate(action as Update);
405405
}
406406

407-
private onAction(event: EditorActionEvent<EditorAction>) {
407+
private async onAction(event: EditorActionEvent<EditorAction>) {
408408
if (isSimple(event.detail.action)) {
409409
if (this.onSimpleAction(event.detail.action))
410410
this.logSimpleAction(event.detail.action);
@@ -433,6 +433,7 @@ export function Editing<TBase extends LitElementConstructor>(Base: TBase) {
433433
newDoc.documentElement.replaceWith(this.doc.documentElement);
434434
this.doc = newDoc;
435435

436+
await this.updateComplete;
436437
this.dispatchEvent(newValidateEvent());
437438
}
438439

0 commit comments

Comments
 (0)