From 7d7cdb7f4738d4417214b76db01ef0b5e7b24ac9 Mon Sep 17 00:00:00 2001 From: Matt Gabrenya Date: Sat, 10 Feb 2024 11:14:58 -0700 Subject: [PATCH] refactor(tauri/ui): fetch first page of table in AppTable component --- tauri-app/src/lib/components/AppTable.svelte | 2 ++ tauri-app/src/lib/storesGeneric/listStore.ts | 1 + tauri-app/src/routes/order-clears/+page.svelte | 1 - tauri-app/src/routes/orders/+page.svelte | 1 - tauri-app/src/routes/vaults/[id]/+page.svelte | 1 - 5 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tauri-app/src/lib/components/AppTable.svelte b/tauri-app/src/lib/components/AppTable.svelte index b9661eff5..9657976d5 100644 --- a/tauri-app/src/lib/components/AppTable.svelte +++ b/tauri-app/src/lib/components/AppTable.svelte @@ -18,6 +18,8 @@ export let emptyMessage: string = "None found" export let rowHoverable = true; export let enableCsvExport = true; + + listStore.fetchFirst(); {#if $listStore.currentPage.length === 0} diff --git a/tauri-app/src/lib/storesGeneric/listStore.ts b/tauri-app/src/lib/storesGeneric/listStore.ts index e5a2e4f4e..85c26ab4b 100644 --- a/tauri-app/src/lib/storesGeneric/listStore.ts +++ b/tauri-app/src/lib/storesGeneric/listStore.ts @@ -10,6 +10,7 @@ type Unsubscriber = () => void; export interface PaginatedCachedStore { subscribe: ( subscriber: Subscriber>, invalidate?: Invalidator>) => Unsubscriber, fetchPage: (page?: number) => Promise; + fetchFirst: () => Promise; fetchPrev: () => Promise; fetchNext: () => Promise; exportCsv: () => void; diff --git a/tauri-app/src/routes/order-clears/+page.svelte b/tauri-app/src/routes/order-clears/+page.svelte index a3b9c7233..262c45fb4 100644 --- a/tauri-app/src/routes/order-clears/+page.svelte +++ b/tauri-app/src/routes/order-clears/+page.svelte @@ -19,7 +19,6 @@ import { FileCsvOutline } from 'flowbite-svelte-icons'; redirectIfSettingsNotDefined(); - orderClearsList.fetchFirst(); diff --git a/tauri-app/src/routes/orders/+page.svelte b/tauri-app/src/routes/orders/+page.svelte index 89fe408b6..05b75b98e 100644 --- a/tauri-app/src/routes/orders/+page.svelte +++ b/tauri-app/src/routes/orders/+page.svelte @@ -8,7 +8,6 @@ import TableOrders from '$lib/components/TableOrders.svelte'; redirectIfSettingsNotDefined(); - ordersList.fetchFirst(); diff --git a/tauri-app/src/routes/vaults/[id]/+page.svelte b/tauri-app/src/routes/vaults/[id]/+page.svelte index 234ccb2f6..37f3dc0f7 100644 --- a/tauri-app/src/routes/vaults/[id]/+page.svelte +++ b/tauri-app/src/routes/vaults/[id]/+page.svelte @@ -34,7 +34,6 @@ } const vaultListBalanceChanges = useVaultListBalanceChanges($page.params.id); - vaultListBalanceChanges.fetchFirst();