fix: fetch 13 articles so Latest grid shows 12 after hero filter; hide Load More when all articles already loaded
This commit is contained in:
@@ -68,7 +68,7 @@ export default async function CategoryPage({ params }: Props) {
|
||||
<ArticleCard key={article.id} article={article} />
|
||||
))}
|
||||
</div>
|
||||
<LoadMoreButton categorySlug={categorySlug} initialCount={articles.length} />
|
||||
<LoadMoreButton categorySlug={categorySlug} initialCount={articles.length} hasMore={articles.length >= 24} />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
+2
-2
@@ -11,12 +11,12 @@ export default async function HomePage() {
|
||||
try {
|
||||
const [settings, articles] = await Promise.all([
|
||||
getSiteSettings(),
|
||||
getArticles({ limit: 12 }),
|
||||
getArticles({ limit: 13 }),
|
||||
])
|
||||
heroArticle = settings.hero_article
|
||||
latestArticles = settings.hero_article
|
||||
? articles.filter((a) => a.id !== settings.hero_article!.id)
|
||||
: articles
|
||||
: articles.slice(0, 12)
|
||||
} catch {
|
||||
// Directus not available yet
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user