fix: \total\ computed has no undefined guard — shows initial stake amount during loading (#424)

When profit or taxPaidGes were undefined (data still loading), the
computed returned props.amount due to the ?? 0 fallbacks. The computed
now returns undefined until both values are loaded, and the template
guard is simplified to total !== undefined.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-06 06:31:49 +00:00
parent 37d7339fbf
commit 0063e94007

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(() => {