File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
apps/site/next-data/providers Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -4,18 +4,16 @@ import { BLOG_POSTS_PER_PAGE } from '@/next.constants.mjs';
44import { blogData } from '@/next.json.mjs' ;
55import type { BlogCategory , BlogPostsRSC } from '@/types' ;
66
7- function getPosts ( ) {
8- return blogData . posts . map ( post => ( {
7+ const blogPosts = cache ( ( ) =>
8+ blogData . posts . map ( post => ( {
99 ...post ,
1010 date : new Date ( post . date ) ,
11- } ) ) ;
12- }
13-
14- const posts = getPosts ( ) ;
11+ } ) )
12+ ) ;
1513
1614export const provideBlogPosts = cache (
1715 ( category : BlogCategory ) : BlogPostsRSC => {
18- const categoryPosts = posts
16+ const categoryPosts = blogPosts ( )
1917 . filter ( post => post . categories . includes ( category ) )
2018 . sort ( ( a , b ) => b . date . getTime ( ) - a . date . getTime ( ) ) ;
2119
You can’t perform that action at this time.
0 commit comments