From ac392302712a430cb6a2729e4d815bb49d0a4fbd Mon Sep 17 00:00:00 2001 From: ilya-bkv Date: Fri, 26 Apr 2024 06:05:10 +0300 Subject: [PATCH 1/2] update --- src/components/Views/Author/Author.tsx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/components/Views/Author/Author.tsx b/src/components/Views/Author/Author.tsx index ca2cdd0c..61cf9130 100644 --- a/src/components/Views/Author/Author.tsx +++ b/src/components/Views/Author/Author.tsx @@ -113,12 +113,7 @@ export const AuthorView = (props: Props) => { onMount(() => { if (!modal) hideModal() checkBioHeight() - fetchData(props.authorSlug) - - // pagination - if (sortedArticles().length === PRERENDERED_ARTICLES_COUNT) { - loadMore() - } + loadMore() }) const pages = createMemo(() => @@ -132,12 +127,17 @@ export const AuthorView = (props: Props) => { setCommented(data) } - createEffect(() => { - if (author()) { - fetchData(author().slug) - fetchComments(author()) - } - }) + const authorSlug = createMemo(() => author()?.slug) + createEffect( + on( + () => authorSlug(), + (slug) => { + fetchData(slug) + fetchComments(author()) + }, + { defer: true }, + ), + ) const ogImage = createMemo(() => author()?.pic From b3155c453515e05c42640efdb334d02992289b51 Mon Sep 17 00:00:00 2001 From: ilya-bkv Date: Fri, 26 Apr 2024 06:13:23 +0300 Subject: [PATCH 2/2] fix author view --- src/components/Views/Author/Author.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/Views/Author/Author.tsx b/src/components/Views/Author/Author.tsx index 61cf9130..3c87d04b 100644 --- a/src/components/Views/Author/Author.tsx +++ b/src/components/Views/Author/Author.tsx @@ -112,6 +112,7 @@ export const AuthorView = (props: Props) => { onMount(() => { if (!modal) hideModal() + fetchData(props.authorSlug) checkBioHeight() loadMore() }) @@ -131,8 +132,8 @@ export const AuthorView = (props: Props) => { createEffect( on( () => authorSlug(), - (slug) => { - fetchData(slug) + () => { + fetchData(authorSlug()) fetchComments(author()) }, { defer: true },