Skip to content

refactor: apply vercel-react-best-practices review#5

Open
N-Laboratory wants to merge 1 commit into
mainfrom
refactor/apply-react-best-practices
Open

refactor: apply vercel-react-best-practices review#5
N-Laboratory wants to merge 1 commit into
mainfrom
refactor/apply-react-best-practices

Conversation

@N-Laboratory
Copy link
Copy Markdown
Owner

apply vercel-react-best-practices review

Copilot AI review requested due to automatic review settings March 29, 2026 08:59
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
next-strapi-cms Ready Ready Preview, Comment Mar 29, 2026 8:59am

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR applies “vercel-react-best-practices” recommendations by moving article search/filtering to server-side routing, aligning microCMS fetching with Next.js caching, and trimming client-only dependencies.

Changes:

  • Refactor microCMS data fetching to use Next.js Data Cache + React cache() with revalidation and cache tags.
  • Replace client-side SWR/axios-based search with a dedicated /search App Router page using searchParams.
  • Reduce client bundle and dependencies by removing SWR/axios/simplebar/zod usage and adjusting analytics loading.

Reviewed changes

Copilot reviewed 21 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/types/index.ts Extends Article with createdAt / publishedAt.
src/libs/microcms/client.ts Adds caching/revalidate/tag behavior for list/detail fetches.
src/features/home/components/useArticleSearch.ts Removes client-side SWR hook (deleted).
src/features/home/components/TopPage.tsx Converts to server-driven search/category navigation via links and form action.
src/features/home/components/ArticleCard.tsx Removes memo, tweaks CTA label.
src/features/common/components/AnalyticsProvider.tsx Adds client-only analytics wrapper via dynamic import.
src/features/articles/utils/parser.tsx Removes comments only; logic unchanged.
src/features/articles/components/Code.tsx Removes client-only SimpleBar usage; uses native overflow container.
src/features/articles/components/Code.module.css Adds native scrollbar styling.
src/features/articles/components/ArticleHeader.tsx Updates date label text.
src/app/search/page.tsx Adds new server-rendered search page using searchParams.
src/app/page.tsx Adds revalidate and updates metadata description.
src/app/layout.tsx Moves analytics to provider; adjusts external link handling.
src/app/not-found.tsx Updates copy text.
src/app/loading.tsx Updates copy text.
src/app/error/page.tsx Updates copy text.
src/app/articles/[id]/page.tsx Adds revalidate and metadata copy tweak.
src/app/api/list/route.ts Removes API endpoint used by SWR search (deleted).
src/app/[others]/page.tsx Updates copy text.
package.json Removes unused deps (axios/swr/simplebar/zod/etc.).
package-lock.json Lockfile updated accordingly.
README.md Updates project description/setup/docs.
.gitignore Adds ignores for .codex/ and skills-lock.json.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/types/index.ts
Comment on lines 12 to +16
overview: string
category: string
createdDate: string
createdAt: string
publishedAt: string
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Article 型が詳細用の detailcreatedAt / publishedAt を必須にしていますが、一覧取得では fields でそれらを含めない指定になっています(例: Home/Search では id,title,overview,... のみ)。microCMS の fields 指定で実際に返るフィールドが絞られる場合、ランタイムではこれらが undefined になり得るので、(1) 一覧用の型(例: ArticleSummary)を別に作る/Pick を使う、または (2) これらのプロパティを optional にして型を実態に合わせる、のどちらかに寄せた方が安全です。

Copilot uses AI. Check for mistakes.
Comment on lines +45 to +49
export const getArticleList = cache(async (fieldNames?: string, keyword?: string) => {
const normalizedKeyword = keyword?.trim()

try {
return await client.getList<Article>({
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getArticleListfields 引数で取得フィールドを可変にしている一方で、返却型を常に client.getList<Article> に固定しているため、呼び出し側が「Article の全プロパティがある」前提で書けてしまいます。fields の指定と整合するように、一覧用の型を導入するか、getArticleList<T>() のようにジェネリクスで返却型を受け取れる形にすると型安全になります。

Suggested change
export const getArticleList = cache(async (fieldNames?: string, keyword?: string) => {
const normalizedKeyword = keyword?.trim()
try {
return await client.getList<Article>({
export const getArticleList = cache(async <T = Article>(fieldNames?: string, keyword?: string) => {
const normalizedKeyword = keyword?.trim()
try {
return await client.getList<T>({

Copilot uses AI. Check for mistakes.
Comment thread src/app/layout.tsx
<a
href={item.url}
target="_blank"
rel="noreferrer"
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

外部リンクを target="_blank" で開く場合、relnoopener を含めないと window.opener 経由の reverse tabnabbing リスクがあります。noreferrer だけでもブラウザによっては抑止されますが、明示的に rel="noopener noreferrer" にしておくのが安全です。

Suggested change
rel="noreferrer"
rel="noopener noreferrer"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants