mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix conditional useMemo
This commit is contained in:
@@ -1,12 +1,14 @@
|
|||||||
import { useMemo } from 'react'
|
import { useMemo } from 'react'
|
||||||
|
|
||||||
const useStateString = (commentOrSubplebbit) => {
|
const useStateString = (commentOrSubplebbit) => {
|
||||||
// dont show state string if the data is already fetched
|
|
||||||
if (commentOrSubplebbit?.updatedAt || commentOrSubplebbit?.state === 'succeeded') {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
return useMemo(() => {
|
return useMemo(() => {
|
||||||
|
|
||||||
|
// dont show state string if the data is already fetched
|
||||||
|
if (commentOrSubplebbit?.updatedAt || commentOrSubplebbit?.state === 'succeeded') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (!commentOrSubplebbit?.clients) {
|
if (!commentOrSubplebbit?.clients) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user