Refactor budget and transaction state management to use $derived for improved reactivity
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import '../app.css';
|
||||
let { children, data } = $props();
|
||||
let budgets = $state(data.budgets);
|
||||
let budgets = $derived(data.budgets);
|
||||
let newBudget = $state({
|
||||
name: '',
|
||||
amount: 0,
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<script>
|
||||
|
||||
let { data } = $props();
|
||||
let budget = $state(data.budgets.find((b) => b.id == data.slug) || {});
|
||||
let transactions = $state(data.transactions || []);
|
||||
let budget = $derived(data.budgets.find((b) => b.id == data.slug) || {});
|
||||
let transactions = $derived(data.transactions || []);
|
||||
let toDeleteBudget = $state(null);
|
||||
|
||||
async function deleteBudget() {
|
||||
|
||||
Reference in New Issue
Block a user