Skip to content

Commit 1548282

Browse files
authored
fix(editing): wait for new doc before validating (openscd#879)
1 parent 7a12d77 commit 1548282

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Editing.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { LitElement, property } from 'lit-element';
1+
import { property } from 'lit-element';
22
import { get } from 'lit-translate';
33

44
import {
@@ -421,8 +421,6 @@ export function Editing<TBase extends LitElementConstructor>(Base: TBase) {
421421
);
422422
}
423423

424-
this.dispatchEvent(newValidateEvent());
425-
426424
if (!this.doc) return;
427425

428426
const newDoc = document.implementation.createDocument(
@@ -434,6 +432,8 @@ export function Editing<TBase extends LitElementConstructor>(Base: TBase) {
434432
// change the document object reference to enable reactive updates
435433
newDoc.documentElement.replaceWith(this.doc.documentElement);
436434
this.doc = newDoc;
435+
436+
this.dispatchEvent(newValidateEvent());
437437
}
438438

439439
private async onOpenDoc(event: OpenDocEvent) {

0 commit comments

Comments
 (0)