MCPcopy Create free account
hub / github.com/dailydotdev/apps / useTrackPostView

Function useTrackPostView

packages/shared/src/hooks/post/useTrackPostView.ts:11–25  ·  view source on GitHub ↗
({
  post,
  shouldTrack = true,
}: UseTrackPostViewProps)

Source from the content-addressed store, hash-verified

9}
10
11export const useTrackPostView = ({
12 post,
13 shouldTrack = true,
14}: UseTrackPostViewProps): void => {
15 const { user } = useAuthContext();
16 const onSendViewPost = useViewPost();
17
18 useEffect(() => {
19 if (!shouldTrack || !post?.id || !user?.id) {
20 return;
21 }
22
23 onSendViewPost(post.id);
24 }, [onSendViewPost, post?.id, shouldTrack, user?.id]);
25};

Callers 4

PostContentRawFunction · 0.90
SquadPostContentRawFunction · 0.90
CollectionPostContentRawFunction · 0.90
PostFocusCardFunction · 0.90

Calls 2

useAuthContextFunction · 0.90
useViewPostFunction · 0.90

Tested by

no test coverage detected