diff --git a/net/web/src/session/conversation/useConversation.hook.js b/net/web/src/session/conversation/useConversation.hook.js index 68fd591d..b56b3a2a 100644 --- a/net/web/src/session/conversation/useConversation.hook.js +++ b/net/web/src/session/conversation/useConversation.hook.js @@ -7,7 +7,6 @@ import { StoreContext } from 'context/StoreContext'; import { CardContext } from 'context/CardContext'; import { ProfileContext } from 'context/ProfileContext'; import { isUnsealed, getChannelSeals, getContentKey, encryptTopicSubject } from 'context/sealUtil'; - import { decryptTopicSubject } from 'context/sealUtil'; import { getProfileByGuid } from 'context/cardUtil'; @@ -19,7 +18,6 @@ export function useConversation(cardId, channelId) { uploadError: false, uploadPercent: 0, topics: [], - loading: false, sealed: false, contentKey: null, busy: false, @@ -107,9 +105,8 @@ export function useConversation(cardId, channelId) { const { card, channel } = conversationId.current; loading.current = true; conversationId.current = null; - updateState({ loading: true, contentKey: null }); + updateState({ contentKey: null }); await conversation.actions.setChannel(card, channel); - updateState({ loading: false }); loading.current = false; await setChannel(); } diff --git a/net/web/test/Thread.test.js b/net/web/test/Thread.test.js new file mode 100644 index 00000000..ef708563 --- /dev/null +++ b/net/web/test/Thread.test.js @@ -0,0 +1,77 @@ +import React, { useState, useEffect, useContext } from 'react'; +import {render, act, screen, waitFor, fireEvent} from '@testing-library/react' +import { AppContextProvider } from 'context/AppContext'; +import { AccountContextProvider } from 'context/AccountContext'; +import { ProfileContext, ProfileContextProvider } from 'context/ProfileContext'; +import { StoreContextProvider } from 'context/StoreContext'; +import { ViewportContextProvider } from 'context/ViewportContext'; +import { ConversationContextProvider } from 'context/ConversationContext'; +import { CardContextProvider } from 'context/CardContext'; +import { UploadContextProvider } from 'context/UploadContext'; +import { useConversation } from 'session/conversation/useConversation.hook'; + +import * as fetchUtil from 'api/fetchUtil'; + +function ThreadView() { + const { state, actions } = useConversation('card01', 'channel01'); + const [renderCount, setRenderCount] = useState(0); + + useEffect(() => { + const rendered = []; + setRenderCount(renderCount + 1); + }, [state]); + + return ( +
+ ); +} + +function ThreadTestApp() { + return ( +