fix: sync payments page state on URL param changes
All checks were successful
CI / update (push) Successful in 1m26s

$state() only captured initial data prop values, so navigating to
different offset/limit params always showed the first page results.
This commit is contained in:
2026-02-12 17:44:54 +01:00
parent 2f711c66b0
commit 443e3300a1

View File

@@ -19,6 +19,14 @@
let limit = $state(data.limit || 20);
let hasMore = $state(data.hasMore || false);
// Re-sync local state when server data changes (e.g. URL param navigation)
$effect(() => {
payments = data.payments || [];
currentPage = Math.floor(data.currentOffset / data.limit);
limit = data.limit || 20;
hasMore = data.hasMore || false;
});
// Progressive enhancement: only load if JavaScript is available
onMount(async () => {
// Mark that JavaScript is loaded for CSS