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:
achmad
2026-05-31 16:46:31 +07:00
parent 75d4da380e
commit 4befb572a3
3 changed files with 6 additions and 5 deletions
+3 -2
View File
@@ -7,13 +7,14 @@ import ArticleCard from './ArticleCard'
interface Props {
categorySlug: string
initialCount: number
hasMore?: boolean
}
export default function LoadMoreButton({ categorySlug, initialCount }: Props) {
export default function LoadMoreButton({ categorySlug, initialCount, hasMore: initialHasMore = true }: Props) {
const [articles, setArticles] = useState<Article[]>([])
const [offset, setOffset] = useState(initialCount)
const [loading, setLoading] = useState(false)
const [hasMore, setHasMore] = useState(true)
const [hasMore, setHasMore] = useState(initialHasMore)
async function loadMore() {
setLoading(true)