Merge pull request #1337 from umbraco/bugfix/confirm-modal-method

fix modal controllers rejection
This commit is contained in:
Niels Lyngsø
2024-03-01 13:30:17 +01:00
committed by GitHub
4 changed files with 8 additions and 3 deletions

View File

@@ -17,6 +17,7 @@ export class UmbDeleteEntityAction<
color: 'danger',
confirmLabel: 'Delete',
});
await this.repository?.delete(this.unique);
}
}

View File

@@ -27,6 +27,7 @@ export class UmbExtensionCollectionElement extends UmbCollectionDefaultElement {
});
}
// TODO: make this a utility function, please check that we do not already have on for this: [NL]
// credit: https://stackoverflow.com/a/7225450/12787 [LK]
#camelCaseToWords(input: string) {
const result = input.replace(/([A-Z])/g, ' $1');
@@ -35,7 +36,6 @@ export class UmbExtensionCollectionElement extends UmbCollectionDefaultElement {
#onChange(event: UUISelectEvent) {
const extensionType = event.target.value;
console.log('onChange', extensionType);
this.#collectionContext?.setFilter({ type: extensionType });
}

View File

@@ -13,9 +13,11 @@ export class UmbConfirmModalController extends UmbControllerBase {
data: args,
});
await modalContext.onSubmit().catch(() => {
const p = modalContext.onSubmit();
p.catch(() => {
this.destroy();
});
await p;
// This is a one time off, so we can destroy our selfs.
this.destroy();

View File

@@ -36,7 +36,9 @@ export class UmbPickDocumentVariantModalController extends UmbControllerBase {
value: { selection: selected.map((x) => x.toString()).filter((v, i, a) => a.indexOf(v) === i) ?? [] },
});
const result = await modalContext.onSubmit().catch(() => undefined);
const p = modalContext.onSubmit();
p.catch(() => this.destroy());
const result = await p;
// This is a one time off, so we can destroy our selfs.
this.destroy();