fetch-comments-fix
This commit is contained in:
parent
8caa4f823a
commit
f6c64b1d46
|
@ -25,6 +25,7 @@ import { Row3 } from '../../Feed/Row3'
|
||||||
|
|
||||||
import styles from './Author.module.scss'
|
import styles from './Author.module.scss'
|
||||||
import stylesArticle from '../../Article/Article.module.scss'
|
import stylesArticle from '../../Article/Article.module.scss'
|
||||||
|
import { useFollowing } from '../../../context/following'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
shouts: Shout[]
|
shouts: Shout[]
|
||||||
|
@ -37,6 +38,7 @@ const LOAD_MORE_PAGE_SIZE = 9
|
||||||
|
|
||||||
export const AuthorView = (props: Props) => {
|
export const AuthorView = (props: Props) => {
|
||||||
const { t } = useLocalize()
|
const { t } = useLocalize()
|
||||||
|
const { loadSubscriptions } = useFollowing()
|
||||||
const { sortedArticles } = useArticlesStore({ shouts: props.shouts })
|
const { sortedArticles } = useArticlesStore({ shouts: props.shouts })
|
||||||
const { authorEntities } = useAuthorsStore({ authors: [props.author] })
|
const { authorEntities } = useAuthorsStore({ authors: [props.author] })
|
||||||
const { page: getPage } = useRouter()
|
const { page: getPage } = useRouter()
|
||||||
|
@ -128,6 +130,7 @@ export const AuthorView = (props: Props) => {
|
||||||
// pagination
|
// pagination
|
||||||
if (sortedArticles().length === PRERENDERED_ARTICLES_COUNT) {
|
if (sortedArticles().length === PRERENDERED_ARTICLES_COUNT) {
|
||||||
loadMore()
|
loadMore()
|
||||||
|
loadSubscriptions()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -145,13 +148,9 @@ export const AuthorView = (props: Props) => {
|
||||||
|
|
||||||
const [commented, setCommented] = createSignal<Reaction[]>([])
|
const [commented, setCommented] = createSignal<Reaction[]>([])
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
if (author() && getPage().route === 'authorComments') {
|
const a = author()
|
||||||
console.debug('[components.Author] routed to comments')
|
if (a) {
|
||||||
try {
|
fetchComments(a)
|
||||||
fetchComments(author())
|
|
||||||
} catch (error) {
|
|
||||||
console.error('[components.Author] fetch error', error)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user