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