Fix buyables not supporting CoercableComponents for displays

This commit is contained in:
thepaperpilot 2022-03-16 11:20:53 -05:00
parent 31f431af83
commit e076c84483

View file

@ -162,12 +162,10 @@ export function createBuyable<T extends BuyableOptions>(
buyable.display = jsx(() => {
// TODO once processComputable types correctly, remove this "as X"
const currDisplay = unref(display) as BuyableDisplay;
if (
currDisplay != null &&
!isCoercableComponent(currDisplay) &&
buyable.cost != null &&
buyable.resource != null
) {
if (isCoercableComponent(currDisplay)) {
return <currDisplay />;
}
if (currDisplay != null && buyable.cost != null && buyable.resource != null) {
const genericBuyable = buyable as GenericBuyable;
const Title = coerceComponent(currDisplay.title || "", "h3");
const Description = coerceComponent(currDisplay.description);