1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

add hasLit condition on getMessages

This commit is contained in:
marcoelissa 2022-12-15 02:32:02 +07:00
parent d1acec0f29
commit cccaa60645

View File

@ -30,7 +30,7 @@ export default function DmConversation() {
}
const getMessages = async (polling = false) => {
if (isLoading) return
if (isLoading || !hasLit) return
if (!polling) setIsLoading(true)
@ -65,7 +65,7 @@ export default function DmConversation() {
async () => {
getMessages(true)
},
!isLoading ? 15000 : false
!isLoading && hasLit ? 15000 : false
)
const showTime = (streamId: string): boolean => {
@ -110,14 +110,14 @@ export default function DmConversation() {
useEffect(() => {
if (isMounted) {
if (conversationId && orbis) {
if (conversationId && orbis && hasLit) {
getMessages()
} else {
setMessages([])
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [conversationId, orbis, isMounted])
}, [conversationId, orbis, hasLit, isMounted])
useEffect(() => {
const el = messagesWrapper.current