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:
parent
37d7339fbf
commit
0063e94007
1 changed files with 5 additions and 2 deletions
|
|
@ -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(() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue