diff --git a/src/lib/components/News.svelte b/src/lib/components/News.svelte index 56a181bd..9adfe5bd 100644 --- a/src/lib/components/News.svelte +++ b/src/lib/components/News.svelte @@ -50,9 +50,13 @@ } function loadMoreData() { - const nextIndex = newsList?.length; - const newArticles = rawData?.slice(nextIndex, nextIndex + 20); - newsList = [...newsList, ...newArticles]; + const nextIndex = newsList.length; // Start from the current length of newsList + const remainingArticles = rawData?.slice(nextIndex, nextIndex + 20); // Get the next 20 articles + + // Append the new articles to the newsList + if (remainingArticles.length > 0) { + newsList = [...newsList, ...remainingArticles]; + } } $: filteredNewsList = @@ -93,11 +97,7 @@ -