Checklist สำหรับรีวิว
นี่คือ checklist ที่ควรไล่ดู — ด้วยตา ในทุก diff ไม่ว่าจะเป็นของคุณหรือของ AI — หลังจากเครื่องมือใน Verification Tools รันแล้วผ่านสะอาด มันตั้งใจให้อยู่ในกระดาษหน้าเดียวที่ print ได้: checklist ที่ไม่มีใครเปิดดูจริงระหว่างรีวิวไม่มีค่าอะไรเลย ทุกบรรทัดลิงก์ไปบทที่อธิบายว่า ทำไม เพื่อให้หน้านี้ยังคงเป็นแค่ list ไม่ใช่การรื้อฟื้นทั้งคอร์สอีกรอบ กลุ่มต่างๆ เรียงตามลำดับเดียวกับ วิธีอ่านโค้ด Next.js ที่คุณไม่ได้เขียนเอง บวกกลุ่มปิดท้ายเรื่อง performance
flowchart LR B["Boundaries"] --> H["Mostly human review<br/>(1 real build-time check: router.push in a Server Component)"] A["Auth"] --> H E["Errors and redirects"] --> H D["Data and caching"] --> P["Partial tool coverage<br/>(tsc catches revalidateTag; next build catches cacheComponents conflicts)"] C["Config and env"] --> P F["Performance"] --> H
Boundaries
หัวข้อที่มีชื่อว่า “Boundaries”'use client'ทุกตัวอยู่ต่ำในต้นไม้เท่าที่จะทำได้ไหม แทนที่จะอยู่ใน layout หรือ page ที่ใช้ร่วมกัน? ดู Server and Client Components- prop ทุกตัวที่ข้าม boundary Server → Client ยังเป็น plain data (หรือ Server Action จริงๆ) อยู่ไหม ไม่มี instance ของ class เปล่าๆ หรือ function reference ที่ไม่ได้ห่อ? ดู Server and Client Components
ssr: falseบนnext/dynamicถูกใช้เฉพาะข้างใน Client Component เท่านั้นไหม? ดู AI Bug Catalog entry 3useFormStatusรันใน component ที่ nest อยู่ ข้างใน<form>ไม่ใช่ component เดียวกับที่ render มันไหม? ดู Forms and Progressive Enhancement- hook สำหรับ pending state ทุกตัวเป็น
useActionState(จากreact) ไม่ใช่useFormState(จากreact-dom) ที่ deprecate แล้วใช่ไหม? ดู AI Bug Catalog entry 5 - การเรียก
useRouter/router.pushทุกครั้งอยู่ข้างใน Client Component ไม่ใช่ Server Component ใช่ไหม? ดู Server and Client Components - data fetch นี้รันครั้งเดียวใน Server Component แทน
useEffectฝั่ง client ได้ไหม? ดู Fetching in Server Components
Data flow และ caching model
หัวข้อที่มีชื่อว่า “Data flow และ caching model”- การตั้งค่า
cacheComponentsในnext.config.tsตรงกับสมมติฐานของทุก route ไหม — export ของ Route Segment Config หรือ'use cache'ไม่ใช่ผสมกัน? ดู Route Segment Config and Runtimes - การเรียก
fetchทุกครั้งระบุ cache intent ชัดเจนไหม แทนที่จะสมมติพฤติกรรม cached-by-default ของ Next.js 14? ดู The Four Caching Layers - การเรียก
revalidateTagทุกครั้งส่ง profile ของcacheLifeเป็น argument ที่สองไหม? ดู Revalidation and Cache Invalidation - การอ่าน
cookies()/headers()อยู่ข้างใน<Suspense>boundary ไหม แทนที่จะอยู่บนสุดของหน้าที่ตั้งใจให้เป็น static? ดู Static and Dynamic Rendering - การเข้าถึง
params/searchParamsทุกครั้งawaitแล้ว และ type เป็นPromiseไม่ใช่ object หลวมๆ ใช่ไหม? ดู AI Bug Catalog entry 12 generateStaticParamsป้องกันการ return array ว่างภายใต้ Cache Components ไหม? ดู AI Bug Catalog entry 13export const runtime = 'edge'ทุกตัวถูกลบไปแล้ว หรือเป็นข้อยกเว้นที่จงใจและมีเหตุผลรองรับไหม? ดู Route Segment Config and Runtimes- มี
getServerSideProps/getStaticPropsตกค้างจาก Pages Router อยู่ข้างในapp/หรือเปล่า? ดู What is Next.js and the App Router
Auth ในทุก action และ route handler
หัวข้อที่มีชื่อว่า “Auth ในทุก action และ route handler”- Server Action ทุกตัวเรียกการเช็ค session จริงก่อนแตะข้อมูลไหม ไม่ขึ้นกับว่า UI ไหน render ปุ่มที่เรียกมัน? ดู Server Actions คืออะไร
- mutation ทุกตัวกรองด้วย ID ของ user ที่ยืนยันตัวตนแล้วเอง ไม่ใช่แค่ยืนยันว่า มีใครสักคน login อยู่ใช่ไหม? ดู Security and Patterns
- Route Handler ทุกตัวใช้การเช็ค session แบบเดียวกับที่ Server Action ที่เทียบเท่าจะใช้ไหม? ดู Authentication Patterns
Error และ redirect
หัวข้อที่มีชื่อว่า “Error และ redirect”try/catchทุกอันที่อาจมีredirect()/notFound()อยู่ข้างใน อยู่นอกมันหรือเรียกunstable_rethrowก่อนไหม? ดู Mutations and Revalidationerror.tsxเป็น Client Component ที่เรียกreset()และวางอยู่ที่ segment ซึ่ง parent ของมันควรดักจับ error ใช่ไหม? ดู Pages, Layouts, and Nested Routingglobal-error.tsxถ้ามี render<html>/<body>ของตัวเองไหม? ดู Pages, Layouts, and Nested Routing
Config และ environment
หัวข้อที่มีชื่อว่า “Config และ environment”middleware.tsถูกเปลี่ยนชื่อเป็นproxy.tsแล้วหรือยัง (และ export ของมันเปลี่ยนเป็นproxy)? ดู Middleware and the Request Lifecycle- ตัวแปร
NEXT_PUBLIC_ทุกตัวถูกอ่านแบบ static literalprocess.env.NEXT_PUBLIC_Xไหม ไม่ผ่าน computed key หรือ parameter ของ helper function เลย? ดู AI Bug Catalog entry 19 - มีตัวแปรที่ขึ้นต้น
NEXT_PUBLIC_ตัวไหนเก็บสิ่งที่ควรเป็น secret อยู่จริงไหม? ดู AI Bug Catalog entry 20 metadataBaseถูกตั้งไว้ครั้งเดียวใน root layout ไหม? ดู Metadata and SEO
Performance
หัวข้อที่มีชื่อว่า “Performance”next/imageทุกตัวที่ใช้fillหรือ layout แบบ responsive ประกาศsizesไหม? ดู Images and Fonts<a>ทุกตัวที่ชี้ไปยัง route ภายในเป็น<Link>จริงๆ ไหม? ดู Linking and Navigation- มี
awaitตัวไหนอยู่เหนือ<Suspense>boundary เดียวของหน้า จนบล็อก response ทั้งหมดไหม? ดู Streaming and Suspense - มี
Date.now()/Math.random()ตัวไหนรันข้างใน render ของ Client Component ไหม — ไม่ใช่ Server Component ที่มันไม่มีทาง mismatch เลย? ดู Static and Dynamic Rendering