From e57b24a70e94fff28b9870931bb8b903a32a4dd7 Mon Sep 17 00:00:00 2001 From: Apostolof Date: Wed, 11 Nov 2020 23:11:16 +0200 Subject: [PATCH] Use redux values for self orbit DB --- .../TopicList/TopicListRow/index.jsx | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/packages/concordia-app/src/components/TopicList/TopicListRow/index.jsx b/packages/concordia-app/src/components/TopicList/TopicListRow/index.jsx index dc97a52..2fea75c 100644 --- a/packages/concordia-app/src/components/TopicList/TopicListRow/index.jsx +++ b/packages/concordia-app/src/components/TopicList/TopicListRow/index.jsx @@ -14,22 +14,18 @@ const TopicListRow = (props) => { const dispatch = useDispatch(); useEffect(() => { - if (userAddress === topicData.userAddress) { - const topicsDb = Object.values(orbit.stores).find((store) => store.dbname === 'topics'); - - setTopicSubject(topicsDb.get(topicId)); - return; + if (userAddress !== topicData.userAddress) { + dispatch({ + type: FETCH_USER_DATABASE, + orbit, + userAddress: topicData.userAddress, + }); } - - dispatch({ - type: FETCH_USER_DATABASE, - orbit, - userAddress: topicData.userAddress, - }); }, [dispatch, orbit, topicData.userAddress, topicId, userAddress]); useEffect(() => { - const topicFound = topics.find((topic) => topic.id === topicId); + const topicFound = topics + .find((topic) => topic.id === topicId); if (topicFound) { setTopicSubject(topicFound);