forked from profectus/Profectus
Fixed render issue with createFormulaPreview
This commit is contained in:
parent
a59f77aa6d
commit
d5a7ba4af2
1 changed files with 6 additions and 6 deletions
|
@ -462,13 +462,13 @@ export function createFormulaPreview(
|
||||||
formula: GenericFormula,
|
formula: GenericFormula,
|
||||||
showPreview: Computable<boolean>,
|
showPreview: Computable<boolean>,
|
||||||
previewAmount: Computable<DecimalSource> = 1
|
previewAmount: Computable<DecimalSource> = 1
|
||||||
): ComputedRef<CoercableComponent> {
|
) {
|
||||||
const processedShowPreview = convertComputable(showPreview);
|
const processedShowPreview = convertComputable(showPreview);
|
||||||
const processedPreviewAmount = convertComputable(previewAmount);
|
const processedPreviewAmount = convertComputable(previewAmount);
|
||||||
if (!formula.hasVariable()) {
|
if (!formula.hasVariable()) {
|
||||||
throw new Error("Cannot create formula preview if the formula does not have a variable");
|
throw new Error("Cannot create formula preview if the formula does not have a variable");
|
||||||
}
|
}
|
||||||
return computed(() => {
|
return jsx(() => {
|
||||||
if (unref(processedShowPreview)) {
|
if (unref(processedShowPreview)) {
|
||||||
const curr = formatSmall(formula.evaluate());
|
const curr = formatSmall(formula.evaluate());
|
||||||
const preview = formatSmall(
|
const preview = formatSmall(
|
||||||
|
@ -479,16 +479,16 @@ export function createFormulaPreview(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
return jsx(() => (
|
return (
|
||||||
<>
|
<>
|
||||||
<b>
|
<b>
|
||||||
<i>
|
<i>
|
||||||
{curr}→{preview}
|
{curr} → {preview}
|
||||||
</i>
|
</i>
|
||||||
</b>
|
</b>
|
||||||
</>
|
</>
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
return formatSmall(formula.evaluate());
|
return <>{formatSmall(formula.evaluate())}</>;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue