[FIX] Show more shouts
This commit is contained in:
parent
96d6e6bd0c
commit
4fdd025e44
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user