From c1374115436b97938e0fbd0c1c691ad34f43de6f Mon Sep 17 00:00:00 2001 From: Felipe Barso <77860630+aprendendofelipe@users.noreply.github.com> Date: Mon, 30 Dec 2024 10:11:37 -0300 Subject: [PATCH] feat(analytics): remove experimental content statistics --- pages/[username]/[slug]/index.public.js | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/pages/[username]/[slug]/index.public.js b/pages/[username]/[slug]/index.public.js index 0aa3983c2..41b06cb6d 100644 --- a/pages/[username]/[slug]/index.public.js +++ b/pages/[username]/[slug]/index.public.js @@ -6,7 +6,6 @@ import { AdBanner, Box, Button, Confetti, Content, DefaultLayout, Link, TabCoinB import { CommentDiscussionIcon, CommentIcon, FoldIcon, UnfoldIcon } from '@/TabNewsUI/icons'; import { NotFoundError, ValidationError } from 'errors'; import webserver from 'infra/webserver.js'; -import analytics from 'models/analytics'; import authorization from 'models/authorization.js'; import content from 'models/content.js'; import removeMarkdown from 'models/remove-markdown.js'; @@ -325,26 +324,6 @@ export async function getStaticPaths() { } export const getStaticProps = getStaticPropsRevalidate(async (context) => { - const [content, stats = {}] = await Promise.all([ - getContentData(context), - analytics.getStatsByPath(`/${context.params.username}/${context.params.slug}`), - ]); - - if (content.notFound) { - return content; - } - - return { - props: { - stats, - ...content.props, - }, - revalidate: 1, - swr: { revalidateOnFocus: false }, - }; -}); - -async function getContentData(context) { const userTryingToGet = user.createAnonymous(); let contentTreeFound; @@ -449,5 +428,7 @@ async function getContentData(context) { parentContentFound: JSON.parse(JSON.stringify(secureParentContentFound)), contentMetadata: JSON.parse(JSON.stringify(contentMetadata)), }, + revalidate: 1, + swr: { revalidateOnFocus: false }, }; -} +});