Merge pull request 'fix: total computed has no undefined guard — shows initial stake amount during loading (#424)' (#488) from fix/issue-424 into master

This commit is contained in:
johba 2026-03-06 07:54:19 +01:00
commit 8c893d68e1

View file

@ -50,7 +50,7 @@
</div>
<div class="profit-stats-item profit-stats-total">
<div><b>Total</b></div>
<div>{{ taxPaidGes !== undefined && profit !== undefined ? formatTokenAmount(total) : '...' }} $KRK</div>
<div>{{ total !== undefined ? formatTokenAmount(total) : '...' }} $KRK</div>
</div>
</div>
</div>
@ -132,7 +132,10 @@ const tag = computed(() => {
return '';
});
const total = computed(() => props.amount + (profit.value ?? 0) - (taxPaidGes.value ?? 0));
const total = computed(() => {
if (profit.value === undefined || taxPaidGes.value === undefined) return undefined;
return props.amount + profit.value - taxPaidGes.value;
});
// P&L calculations (FIXED: Use BigInt math to preserve precision)
const grossReturn = computed(() => {