Skip to content

Commit

Permalink
fix: remove unused fields, append sharing links
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgemoya committed May 2, 2024
1 parent 7ec6f83 commit 8635584
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { graphql } from '~/client/graphql';

export const SharingLinksFragment = graphql(`
fragment SharingLinksFragment on BlogPost {
entityId
thumbnailImage {
url: urlTemplate
}
seo {
pageTitle
}
}
`);
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,9 @@
import { SiFacebook, SiLinkedin, SiPinterest, SiX } from '@icons-pack/react-simple-icons';
import { Mail, Printer } from 'lucide-react';

import { FragmentOf, graphql } from '~/client/graphql';
import { FragmentOf } from '~/client/graphql';

import { SEOFragment } from '../page-data';

export const SharingLinksFragment = graphql(
`
fragment SharingLinksFragment on BlogPost {
entityId
thumbnailImage {
altText
url: urlTemplate
}
...SEOFragment
}
`,
[SEOFragment],
);
import { SharingLinksFragment } from './fragment';

interface Props {
blogPost: FragmentOf<typeof SharingLinksFragment>;
Expand Down
11 changes: 7 additions & 4 deletions apps/core/app/[locale]/(default)/blog/[blogId]/page-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { client } from '~/client';
import { graphql } from '~/client/graphql';
import { revalidate } from '~/client/revalidate-target';

import { SharingLinksFragment } from './_components/sharing-links/fragment';

export const SEOFragment = graphql(`
fragment SEOFragment on BlogPost {
seo {
Expand All @@ -22,10 +24,8 @@ const BlogPostPageQuery = graphql(
blog {
isVisibleInNavigation
post(entityId: $entityId) {
entityId
author
htmlBody
id
name
publishedDate {
utc
Expand All @@ -35,7 +35,10 @@ const BlogPostPageQuery = graphql(
altText
url: urlTemplate
}
...SEOFragment
seo {
pageTitle
}
...SharingLinksFragment
}
}
}
Expand All @@ -47,7 +50,7 @@ const BlogPostPageQuery = graphql(
}
}
`,
[SEOFragment],
[SharingLinksFragment],
);

export const getBlogPost = cache(async ({ entityId }: { entityId: number }) => {
Expand Down

0 comments on commit 8635584

Please sign in to comment.