diff --git a/platforms/pictique/src/routes/(protected)/messages/+page.svelte b/platforms/pictique/src/routes/(protected)/messages/+page.svelte index c0697196..14d95be4 100644 --- a/platforms/pictique/src/routes/(protected)/messages/+page.svelte +++ b/platforms/pictique/src/routes/(protected)/messages/+page.svelte @@ -23,6 +23,7 @@ // Pagination and loading state let isLoading = $state(true); + let isLoadingMore = $state(false); let currentPage = $state(1); let totalPages = $state(1); let totalChats = $state(0); @@ -91,21 +92,14 @@ } } - async function loadNextPage() { - if (hasMorePages && !isLoading) { - await loadMessages(currentPage + 1, true); - } - } - - async function loadPreviousPage() { - if (currentPage > 1 && !isLoading) { - await loadMessages(currentPage - 1, false); - } - } - - async function goToPage(page: number) { - if (page >= 1 && page <= totalPages && !isLoading) { - await loadMessages(page, false); + async function loadMoreMessages() { + if (hasMorePages && !isLoadingMore) { + isLoadingMore = true; + try { + await loadMessages(currentPage + 1, true); + } finally { + isLoadingMore = false; + } } } @@ -287,94 +281,26 @@ /> {/each} - - {#if totalPages > 1} -