From 24c028a2337fee3d1d2c566a6b9e24089ef1cf2f Mon Sep 17 00:00:00 2001 From: ilya-bkv Date: Sat, 22 Apr 2023 18:32:21 +0300 Subject: [PATCH] hotfix followed request --- src/components/Views/Author.tsx | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/src/components/Views/Author.tsx b/src/components/Views/Author.tsx index 655eeea2..2e439a80 100644 --- a/src/components/Views/Author.tsx +++ b/src/components/Views/Author.tsx @@ -56,35 +56,34 @@ export const AuthorView = (props: AuthorProps) => { const [subscribedTopics, setSubscribedTopics] = createSignal([]) onMount(async () => { - if (!props.author.slug) return try { - const userSubscribers = await apiClient.getAuthorFollowers({ slug: props.author.slug }) + const userSubscribers = await apiClient.getAuthorFollowers({ slug: props.authorSlug }) setFollowers(userSubscribers) } catch (error) { console.log('[getAuthorFollowers]', error) } try { - const authorSubscriptionsUsers = await apiClient.getAuthorFollowingUsers({ slug: props.author.slug }) + const authorSubscriptionsUsers = await apiClient.getAuthorFollowingUsers({ slug: props.authorSlug }) setFollowingUsers(authorSubscriptionsUsers) } catch (error) { console.log('[getAuthorFollowingUsers]', error) } try { - const authorSubscriptionsTopics = await apiClient.getAuthorFollowingTopics({ - slug: props.author.slug - }) + const authorSubscriptionsTopics = await apiClient.getAuthorFollowingTopics({ slug: props.authorSlug }) setSubscribedTopics(authorSubscriptionsTopics) } catch (error) { console.log('[getAuthorFollowing]', error) } - }) - onMount(() => { if (!searchParams().by) { changeSearchParam('by', 'rating') } + + if (sortedArticles().length === PRERENDERED_ARTICLES_COUNT) { + await loadMore() + } }) const loadMore = async () => { @@ -98,12 +97,6 @@ export const AuthorView = (props: AuthorProps) => { restoreScrollPosition() } - onMount(async () => { - if (sortedArticles().length === PRERENDERED_ARTICLES_COUNT) { - await loadMore() - } - }) - // TODO: use title // const title = createMemo(() => { // const m = searchParams().by @@ -119,15 +112,6 @@ export const AuthorView = (props: AuthorProps) => { const [commented, setCommented] = createSignal([]) - onMount(async () => { - try { - const authorSubscribers = await apiClient.getAuthorFollowers({ slug: props.authorSlug }) - setFollowers(authorSubscribers) - } catch (error) { - console.log('[getAuthorSubscribers]', error) - } - }) - createEffect(async () => { if (searchParams().by === 'commented') { try { @@ -276,6 +260,7 @@ export const AuthorView = (props: AuthorProps) => {
+ asdasd {(follower: Author) => (