Why
A presentational section component that fetches live Notion data conflates data-fetching with rendering, prevents isolated testing without network access, and duplicates fetch logic that already belongs at the page level.
Current state
ui/sections/blog-post-list.tsx imports getPosts from @/io/notion/getPosts (line 3) and calls (await getPosts({ … })).unwrap() (line 30) inside the component. A section component is performing a live Notion API call that belongs at the page entry point (app/blog/page.tsx).
Ideal state
PostList (or the blog-post-list section component) accepts an already-fetched PostListItem[] prop and contains no imports from @/io.
app/blog/page.tsx calls getPosts and passes the result as a prop to the section component.
- The section is renderable in tests with plain props and no network access.
Starting points
ui/sections/blog-post-list.tsx — line 3 (import) and line 30 (call) to remove; component signature to update
app/blog/page.tsx — the correct location for the getPosts call
io/notion/getPosts.ts — the fetch function
QA plan
- Open
ui/sections/blog-post-list.tsx — expect no imports from @/io and a posts: PostListItem[] prop in the component signature.
- Open
app/blog/page.tsx — expect getPosts called here and the result passed to the section component.
- Run
npm run build and npm run test:ci — expect no regressions.
Done when
ui/sections/blog-post-list.tsx contains no @/io imports, accepts a posts prop, and the blog page continues to render correctly.
Why
A presentational section component that fetches live Notion data conflates data-fetching with rendering, prevents isolated testing without network access, and duplicates fetch logic that already belongs at the page level.
Current state
ui/sections/blog-post-list.tsximportsgetPostsfrom@/io/notion/getPosts(line 3) and calls(await getPosts({ … })).unwrap()(line 30) inside the component. A section component is performing a live Notion API call that belongs at the page entry point (app/blog/page.tsx).Ideal state
PostList(or the blog-post-list section component) accepts an already-fetchedPostListItem[]prop and contains no imports from@/io.app/blog/page.tsxcallsgetPostsand passes the result as a prop to the section component.Starting points
ui/sections/blog-post-list.tsx— line 3 (import) and line 30 (call) to remove; component signature to updateapp/blog/page.tsx— the correct location for thegetPostscallio/notion/getPosts.ts— the fetch functionQA plan
ui/sections/blog-post-list.tsx— expect no imports from@/ioand aposts: PostListItem[]prop in the component signature.app/blog/page.tsx— expectgetPostscalled here and the result passed to the section component.npm run buildandnpm run test:ci— expect no regressions.Done when
ui/sections/blog-post-list.tsxcontains no@/ioimports, accepts apostsprop, and the blog page continues to render correctly.