fix conditional useMemo

This commit is contained in:
plebeius.eth
2023-08-30 21:09:12 +02:00
parent 5e586c2e2e
commit df2e764808
+7 -5
View File
@@ -1,12 +1,14 @@
import { useMemo } from 'react'
const useStateString = (commentOrSubplebbit) => {
// dont show state string if the data is already fetched
if (commentOrSubplebbit?.updatedAt || commentOrSubplebbit?.state === 'succeeded') {
return
}
return useMemo(() => {
// dont show state string if the data is already fetched
if (commentOrSubplebbit?.updatedAt || commentOrSubplebbit?.state === 'succeeded') {
return
}
if (!commentOrSubplebbit?.clients) {
return
}