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(() => { buyable.display = jsx(() => {
// TODO once processComputable types correctly, remove this "as X" // TODO once processComputable types correctly, remove this "as X"
const currDisplay = unref(display) as BuyableDisplay; const currDisplay = unref(display) as BuyableDisplay;
if ( if (isCoercableComponent(currDisplay)) {
currDisplay != null && return <currDisplay />;
!isCoercableComponent(currDisplay) && }
buyable.cost != null && if (currDisplay != null && buyable.cost != null && buyable.resource != null) {
buyable.resource != null
) {
const genericBuyable = buyable as GenericBuyable; const genericBuyable = buyable as GenericBuyable;
const Title = coerceComponent(currDisplay.title || "", "h3"); const Title = coerceComponent(currDisplay.title || "", "h3");
const Description = coerceComponent(currDisplay.description); const Description = coerceComponent(currDisplay.description);