Make sure view count fetch runs when claim ID changes. (#617)
This commit is contained in:
parent
b0dbdeae27
commit
5cf78e792b
1 changed files with 1 additions and 2 deletions
|
@ -17,12 +17,11 @@ type Props = {
|
|||
function FileViewCount(props: Props) {
|
||||
const { claimId, fetchViewCount, viewCount, livestream, activeViewers, isLive = false } = props;
|
||||
|
||||
// @Note: it's important this only runs once on initial render.
|
||||
React.useEffect(() => {
|
||||
if (claimId) {
|
||||
fetchViewCount(claimId);
|
||||
}
|
||||
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
}, [claimId]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
const formattedViewCount = Number(viewCount).toLocaleString();
|
||||
|
||||
|
|
Loading…
Reference in a new issue