Refactor budget and transaction state management to use $derived for improved reactivity

This commit is contained in:
2025-07-08 22:00:27 -04:00
parent 883a5f2642
commit 3e7572f3a3
2 changed files with 3 additions and 3 deletions

View File

@ -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,

View File

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