From 6627e0615a30eb7bec330fb49a6ea33f7d998eaa Mon Sep 17 00:00:00 2001 From: Esteban Abaroa Date: Wed, 30 Aug 2023 22:36:33 +0000 Subject: [PATCH] fix state string bug --- src/hooks/useStateString.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/hooks/useStateString.js b/src/hooks/useStateString.js index a357d727..7a0ce193 100644 --- a/src/hooks/useStateString.js +++ b/src/hooks/useStateString.js @@ -1,12 +1,12 @@ 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 } @@ -86,10 +86,10 @@ const useStateString = (commentOrSubplebbit) => { // fallback to comment or subplebbit state when possible if (!stateString) { - if (commentOrSubplebbit?.publishingState !== 'stopped') { + if (commentOrSubplebbit?.publishingState && commentOrSubplebbit?.publishingState !== 'stopped' && commentOrSubplebbit?.publishingState !== 'succeeded') { stateString = commentOrSubplebbit.publishingState } - else if (commentOrSubplebbit?.updatingState !== 'stopped') { + else if (commentOrSubplebbit?.updatingState !== 'stopped' && commentOrSubplebbit?.updatingState !== 'succeeded') { stateString = commentOrSubplebbit.updatingState } if (stateString) {