published-filter-fix

This commit is contained in:
Untone 2023-11-29 15:19:25 +03:00
parent 76a15c8aa9
commit 7bc743d8a7
4 changed files with 6 additions and 8 deletions

View File

@ -55,7 +55,7 @@ export const HomeView = (props: Props) => {
loadTopMonthArticles()
if (sortedArticles().length < PRERENDERED_ARTICLES_COUNT + CLIENT_LOAD_ARTICLES_COUNT) {
const { hasMore } = await loadShouts({
filters: { visibility: 'public' },
filters: { published: true },
limit: CLIENT_LOAD_ARTICLES_COUNT,
offset: sortedArticles().length,
})
@ -84,7 +84,7 @@ export const HomeView = (props: Props) => {
saveScrollPosition()
const { hasMore } = await loadShouts({
filters: { visibility: 'public' },
filters: { published: true },
limit: LOAD_MORE_PAGE_SIZE,
offset: sortedArticles().length,
})

View File

@ -6,7 +6,7 @@ import { apiClient } from '../graphql/client/core'
export const onBeforeRender = async (_pageContext: PageContext) => {
const options = {
filters: { visibility: 'public' },
filters: { published: true },
limit: PRERENDERED_ARTICLES_COUNT,
}
const homeShouts = await apiClient.getShouts({ options })

View File

@ -20,7 +20,7 @@ export const HomePage = (props: PageProps) => {
}
await Promise.all([
loadShouts({ filters: { visibility: 'public' }, limit: PRERENDERED_ARTICLES_COUNT }),
loadShouts({ filters: { published: true }, limit: PRERENDERED_ARTICLES_COUNT }),
loadRandomTopics({ amount: RANDOM_TOPICS_COUNT }),
])

View File

@ -191,7 +191,7 @@ export const loadTopMonthArticles = async (): Promise<void> => {
const after = Math.floor(daysago / 1000)
const options: LoadShoutsOptions = {
filters: {
visibility: 'public',
published: true,
after,
},
order_by: 'rating_stat',
@ -206,9 +206,7 @@ const TOP_ARTICLES_COUNT = 10
export const loadTopArticles = async (): Promise<void> => {
const options: LoadShoutsOptions = {
filters: {
visibility: 'public',
},
filters: { published: true },
order_by: 'rating_stat',
limit: TOP_ARTICLES_COUNT,
}