diff --git a/packages/concordia-app/package.json b/packages/concordia-app/package.json index db994d8..54356c7 100644 --- a/packages/concordia-app/package.json +++ b/packages/concordia-app/package.json @@ -25,7 +25,7 @@ }, "dependencies": { "@ezerous/breeze": "~0.7.0", - "@ezerous/drizzle": "~0.4.3", + "@ezerous/drizzle": "~0.5.0", "@ezerous/eth-identity-provider": "~0.1.2", "@reduxjs/toolkit": "~1.4.0", "@welldone-software/why-did-you-render": "~6.0.5", diff --git a/packages/concordia-app/src/components/PostList/PostListRow/index.jsx b/packages/concordia-app/src/components/PostList/PostListRow/index.jsx index ee438cb..3655066 100644 --- a/packages/concordia-app/src/components/PostList/PostListRow/index.jsx +++ b/packages/concordia-app/src/components/PostList/PostListRow/index.jsx @@ -13,7 +13,7 @@ import { Link } from 'react-router-dom'; import { FORUM_CONTRACT } from 'concordia-shared/src/constants/contracts/ContractNames'; import { POSTS_DATABASE, USER_DATABASE } from 'concordia-shared/src/constants/orbit/OrbitDatabases'; import { FETCH_USER_DATABASE } from '../../../redux/actions/peerDbReplicationActions'; -import { breeze } from '../../../redux/store'; +import { breeze, drizzle } from '../../../redux/store'; import determineKVAddress from '../../../utils/orbitUtils'; import { POST_CONTENT } from '../../../constants/orbit/PostsDatabaseKeys'; import ProfileImage from '../../ProfileImage'; @@ -23,6 +23,8 @@ import './styles.css'; const { orbit } = breeze; +const { contracts: { [FORUM_CONTRACT]: { methods: { getPost: { clearCacheCall: clearGetPostChainData } } } } } = drizzle; + const PostListRow = (props) => { const { id: postId, postIndex, postCallHash, loading, focus, @@ -99,6 +101,8 @@ const PostListRow = (props) => { } }, [focus]); + useEffect(() => () => clearGetPostChainData(postId), [postId]); + return useMemo(() => ( { }, [ownVote, postId, userAccount, voting]); const disableVoting = userAccount === null || !hasSignedUp || postAuthorAddress === null || userAccount === postAuthorAddress; + + // Clear when unmounting + useEffect(() => () => clearGetVoteInfoChainData(postId), [postId]); + return useMemo(() => (