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 @@ -
+
@@ -113,27 +113,31 @@ : ''}">All -
  • - -
  • -
  • - -
  • + {#if rawData.some((item) => checkIfYoutubeVideo(item.url) !== null)} +
  • + +
  • + {/if} + {#if !$page?.url?.pathname.includes("etf")} +
  • + +
  • + {/if}
    @@ -261,10 +265,10 @@
    {/if} - {#if newsList?.length !== rawData?.length && filteredNewsList?.length > 0} + {#if newsList?.length !== rawData?.length && filteredNewsList?.length > 0 && displaySection === "all"} diff --git a/src/routes/stocks/[tickerID]/+page.svelte b/src/routes/stocks/[tickerID]/+page.svelte index ba28f109..2347e4ce 100644 --- a/src/routes/stocks/[tickerID]/+page.svelte +++ b/src/routes/stocks/[tickerID]/+page.svelte @@ -1339,10 +1339,9 @@ class="mt-6 flex flex-col lg:flex-row gap-x-14 items-start w-full justify-between" >
    -