From 7bc743d8a7042a61bc5573b6981be5bdb4b94bba Mon Sep 17 00:00:00 2001 From: Untone Date: Wed, 29 Nov 2023 15:19:25 +0300 Subject: [PATCH] published-filter-fix --- src/components/Views/Home.tsx | 4 ++-- src/pages/index.page.server.ts | 2 +- src/pages/index.page.tsx | 2 +- src/stores/zine/articles.ts | 6 ++---- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/components/Views/Home.tsx b/src/components/Views/Home.tsx index 824546f9..3f01e20f 100644 --- a/src/components/Views/Home.tsx +++ b/src/components/Views/Home.tsx @@ -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, }) diff --git a/src/pages/index.page.server.ts b/src/pages/index.page.server.ts index faa79d5f..5d83268f 100644 --- a/src/pages/index.page.server.ts +++ b/src/pages/index.page.server.ts @@ -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 }) diff --git a/src/pages/index.page.tsx b/src/pages/index.page.tsx index 752fc2bf..f1f08406 100644 --- a/src/pages/index.page.tsx +++ b/src/pages/index.page.tsx @@ -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 }), ]) diff --git a/src/stores/zine/articles.ts b/src/stores/zine/articles.ts index 2bbd530e..613a67c8 100644 --- a/src/stores/zine/articles.ts +++ b/src/stores/zine/articles.ts @@ -191,7 +191,7 @@ export const loadTopMonthArticles = async (): Promise => { 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 => { const options: LoadShoutsOptions = { - filters: { - visibility: 'public', - }, + filters: { published: true }, order_by: 'rating_stat', limit: TOP_ARTICLES_COUNT, }