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