diff --git a/app/components/DocumentMetaWithViews.js b/app/components/DocumentMetaWithViews.js index 92b653f2a..cd0b79764 100644 --- a/app/components/DocumentMetaWithViews.js +++ b/app/components/DocumentMetaWithViews.js @@ -23,6 +23,12 @@ function DocumentMetaWithViews({ to, isDraft, document, ...rest }: Props) { const totalViewers = documentViews.length; const onlyYou = totalViewers === 1 && documentViews[0].user.id; + React.useEffect(() => { + if (!document.isDeleted) { + views.fetchPage({ documentId: document.id }); + } + }, [views, document.id, document.isDeleted]); + const popover = usePopoverState({ gutter: 8, placement: "bottom", diff --git a/app/components/DocumentViews.js b/app/components/DocumentViews.js index 180cb75f2..143524647 100644 --- a/app/components/DocumentViews.js +++ b/app/components/DocumentViews.js @@ -19,12 +19,6 @@ function DocumentViews({ document, isOpen }: Props) { const { t } = useTranslation(); const { views, presence } = useStores(); - React.useEffect(() => { - if (!document.isDeleted) { - views.fetchPage({ documentId: document.id }); - } - }, [views, document.id, document.isDeleted]); - let documentPresence = presence.get(document.id); documentPresence = documentPresence ? Array.from(documentPresence.values())