Adding await tick before updating creditLineRef in editCard() function. Also spread some async
This commit is contained in:
parent
2462dce25a
commit
1785e24623
|
@ -1,5 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount } from "svelte";
|
import { onMount, tick } from "svelte";
|
||||||
import { type Card, type Currency } from "$lib/entities";
|
import { type Card, type Currency } from "$lib/entities";
|
||||||
import { NumberToFPA } from "$lib/util/fpa";
|
import { NumberToFPA } from "$lib/util/fpa";
|
||||||
|
|
||||||
|
@ -70,11 +70,12 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function editCard(card: Card) {
|
async function editCard(card: Card) {
|
||||||
editingCard = { ...card };
|
editingCard = { ...card };
|
||||||
if (balanceRef) {
|
if (balanceRef) {
|
||||||
balanceRef.value = NumberToFPA(card.balance);
|
balanceRef.value = NumberToFPA(card.balance);
|
||||||
}
|
}
|
||||||
|
await tick();
|
||||||
if (creditLineRef) {
|
if (creditLineRef) {
|
||||||
creditLineRef.value = NumberToFPA(card.credit_line);
|
creditLineRef.value = NumberToFPA(card.credit_line);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user