Skip to content

Commit

Permalink
feat(analytics): remove experimental content statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
aprendendofelipe committed Dec 30, 2024
1 parent 26cae9c commit c137411
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions pages/[username]/[slug]/index.public.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 },
};
}
});

0 comments on commit c137411

Please sign in to comment.