chore: fix react render error
This commit is contained in:
parent
990460d7cf
commit
d15c5a21d9
@ -13,7 +13,7 @@ import {
|
||||
Filter as NostrEventFilter,
|
||||
UnsignedEvent
|
||||
} from 'nostr-tools'
|
||||
import React, { useMemo } from 'react'
|
||||
import React, { useEffect, useMemo } from 'react'
|
||||
import { Dispatch, SetStateAction, useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { toast } from 'react-toastify'
|
||||
@ -58,6 +58,10 @@ export const Comments = ({ modDetails, setCommentCount }: Props) => {
|
||||
author: AuthorFilterEnum.All_Comments
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
setCommentCount(commentEvents.length)
|
||||
}, [commentEvents, setCommentCount])
|
||||
|
||||
const userState = useAppSelector((state) => state.user)
|
||||
|
||||
useDidMount(async () => {
|
||||
@ -202,8 +206,6 @@ export const Comments = ({ modDetails, setCommentCount }: Props) => {
|
||||
return true
|
||||
}
|
||||
|
||||
setCommentCount(commentEvents.length)
|
||||
|
||||
const comments = useMemo(() => {
|
||||
let filteredComments = commentEvents
|
||||
if (filterOptions.author === AuthorFilterEnum.Creator_Comments) {
|
||||
|
Loading…
Reference in New Issue
Block a user