[FIX] Show more shouts

This commit is contained in:
ilya-bkv 2024-03-18 10:22:12 +03:00
parent 96d6e6bd0c
commit 4fdd025e44
2 changed files with 1 additions and 3 deletions

View File

@ -64,7 +64,6 @@ export const HomeView = (props: Props) => {
limit: CLIENT_LOAD_ARTICLES_COUNT, limit: CLIENT_LOAD_ARTICLES_COUNT,
offset: sortedArticles().length, offset: sortedArticles().length,
}) })
setIsLoadMoreButtonVisible(hasMore) setIsLoadMoreButtonVisible(hasMore)
} }

View File

@ -131,9 +131,8 @@ export const loadShout = async (slug: string): Promise<void> => {
export const loadShouts = async ( export const loadShouts = async (
options: LoadShoutsOptions, options: LoadShoutsOptions,
): Promise<{ hasMore: boolean; newShouts: Shout[] }> => { ): Promise<{ hasMore: boolean; newShouts: Shout[] }> => {
options.limit += 1
const newShouts = await apiClient.getShouts(options) const newShouts = await apiClient.getShouts(options)
const hasMore = newShouts?.length === options.limit + 1 const hasMore = newShouts?.length !== options.limit + 1 && newShouts?.length !== 0
if (hasMore) { if (hasMore) {
newShouts.splice(-1) newShouts.splice(-1)