Fix the fallback to default values in the button config when the static property is not defined

This commit is contained in:
Sérgio Saquetim 2024-11-07 00:04:03 -03:00
parent 2c0b1621c9
commit 0ce165a451
No known key found for this signature in database
GPG Key ID: B4E3D7F11E793062

View File

@ -108,15 +108,10 @@ export default class PostMenuButtonConfig {
}
let value;
if (typeof klass[property] === "function") {
value = klass[property](args, helperContext(), this.#owner);
} else {
value = klass[property];
}
return (
value ??
this.#staticPropertyWithReplacementFallback(
if (typeof klass[property] === "undefined") {
// fallback to the replacement map if the property is not defined
return this.#staticPropertyWithReplacementFallback(
{
klass: this.#replacementMap.get(klass) || null, // passing null explicitly to avoid using the default value
property,
@ -124,7 +119,13 @@ export default class PostMenuButtonConfig {
defaultValue,
},
_usedKlasses.add(klass)
)
);
);
} else if (typeof klass[property] === "function") {
value = klass[property](args, helperContext(), this.#owner);
} else {
value = klass[property];
}
return value;
}
}