the important fix

This commit is contained in:
Niels Lyngsø
2023-07-25 21:00:23 +02:00
parent a9bb731b29
commit bd59414d48

View File

@@ -18,6 +18,7 @@ export abstract class UmbBaseExtensionController<
#manifest?: ManifestType;
#conditionControllers: Array<UmbExtensionCondition> = [];
#onPermissionChanged: (isPermitted: boolean, controller: SubClassType) => void;
protected _positive?: boolean;
#isPermitted?: boolean;
get weight() {
@@ -153,11 +154,13 @@ export abstract class UmbBaseExtensionController<
#onConditionsChangedCallback = async () => {
const oldValue = this.#isPermitted ?? false;
// Find a condition that is not permitted (Notice how no conditions, means that this extension is permitted)
const conditionsArePositive =
const isPositive =
this.#conditionsAreInitialized() &&
this.#conditionControllers.find((condition) => condition.permitted === false) === undefined;
if (conditionsArePositive) {
this._positive = isPositive;
if (isPositive) {
if (this.#isPermitted !== true) {
this.#isPermitted = await this._conditionsAreGood();
}