Skip to content

Commit 2e11cc8

Browse files
fix(editors/template): properly update xxxType list after add/editing (openscd#582)
1 parent 893c892 commit 2e11cc8

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/editors/Templates.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ export default class TemplatesPlugin extends LitElement {
6666

6767
openLNodeTypeWizard(identity: string): void {
6868
const wizard = lNodeTypeWizard(identity, this.doc);
69-
if (wizard) this.dispatchEvent(newWizardEvent(wizard));
69+
if (wizard)
70+
this.dispatchEvent(
71+
newWizardEvent(() => lNodeTypeWizard(identity, this.doc)!)
72+
);
7073
}
7174

7275
async openCreateDOTypeWizard(): Promise<void> {
@@ -84,12 +87,18 @@ export default class TemplatesPlugin extends LitElement {
8487

8588
openDOTypeWizard(identity: string): void {
8689
const wizard = dOTypeWizard(identity, this.doc);
87-
if (wizard) this.dispatchEvent(newWizardEvent(wizard));
90+
if (wizard)
91+
this.dispatchEvent(
92+
newWizardEvent(() => dOTypeWizard(identity, this.doc)!)
93+
);
8894
}
8995

9096
openDATypeWizard(identity: string): void {
9197
const wizard = editDaTypeWizard(identity, this.doc);
92-
if (wizard) this.dispatchEvent(newWizardEvent(wizard));
98+
if (wizard)
99+
this.dispatchEvent(
100+
newWizardEvent(() => editDaTypeWizard(identity, this.doc)!)
101+
);
93102
}
94103

95104
async openCreateDATypeWizard(): Promise<void> {
@@ -107,7 +116,10 @@ export default class TemplatesPlugin extends LitElement {
107116

108117
openEnumTypeWizard(identity: string): void {
109118
const wizard = eNumTypeEditWizard(identity, this.doc);
110-
if (wizard) this.dispatchEvent(newWizardEvent(wizard));
119+
if (wizard)
120+
this.dispatchEvent(
121+
newWizardEvent(() => eNumTypeEditWizard(identity, this.doc)!)
122+
);
111123
}
112124

113125
async openCreateEnumWizard(): Promise<void> {

0 commit comments

Comments
 (0)