[UXIT-3331][filecoin.io V3] Address Lighthouse audit issues - Fix performance score [skip percy]#2142
[UXIT-3331][filecoin.io V3] Address Lighthouse audit issues - Fix performance score [skip percy]#2142barbaraperic wants to merge 2 commits intomainfrom
Conversation
… from posts. Update postMatchesCategory function to accept BlogPostPreview. Clean up imports in CardImage component.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
There was a problem hiding this comment.
Pull request overview
This PR optimizes the blog listing page's Lighthouse performance scores by reducing the data serialized and sent to the client. The main performance issue was caused by serializing the full markdown content of all 716 blog posts when only metadata was needed for the listing view.
Changes:
- Created
BlogPostPreviewtype that omits thecontentfield fromBlogPost - Updated blog listing page to strip content before passing posts to the client component
- Updated type signatures in components that only need preview data
- Removed unused
clsximport fromCardImagecomponent
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
packages/ui-filecoin/src/components/Card/CardImage.tsx |
Removed unused clsx import |
apps/filecoin-site/src/app/[locale]/blog/types/blogPostType.ts |
Added new BlogPostPreview type that omits the content field |
apps/filecoin-site/src/app/[locale]/blog/utils/postMatchesCategory.ts |
Updated function signature to accept BlogPostPreview instead of BlogPost |
apps/filecoin-site/src/app/[locale]/blog/components/BlogPostList.tsx |
Updated component to accept and use BlogPostPreview type |
apps/filecoin-site/src/app/[locale]/blog/page.tsx |
Strips content field from posts before passing to client component |
Comments suppressed due to low confidence (1)
apps/filecoin-site/src/app/[locale]/blog/page.tsx:39
- For consistency with the performance optimization goal, consider using
postsWithoutContentinstead ofsortedPostshere. WhilegenerateStructuredDataonly accesses theslugandtitlefields and doesn't usecontent, using the stripped version would be more consistent with the rest of the changes and makes the intent clearer.
<StructuredDataScript
structuredData={generateStructuredData(BLOG_SEO, sortedPosts)}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CharlyMartin
left a comment
There was a problem hiding this comment.
@barbaraperic, I totally agree that removing content will help reduce load significantly.
One thing I find odd is that we fetch content, only to remove it later. This seems wasteful.
How would you feel about adding a withContent param to the fetching function and then creating a new helper getBlogPostsPreviewData that returns just the metadata? (Everything but the content)
What do you think?
📝 Description
The blog listing page had poor Lighthouse performance scores:
Stripped the
contentfield from blog posts before passing to the client component, as serializing the full markdown content of 716 posts was causing significant rendering delays.🛠️ Key Changes
BlogPostPreviewtype that omits contentBlogPostListandpostMatchesCategoryto use the new type📸 Screenshots
blog
blog/:slug