Skip to content

Use optional chaining for post navigation image access in PostLayout - #113

Draft
qmauvnt with Copilot wants to merge 2 commits into
mainfrom
copilot/sub-pr-110-another-one
Draft

Use optional chaining for post navigation image access in PostLayout#113
qmauvnt with Copilot wants to merge 2 commits into
mainfrom
copilot/sub-pr-110-another-one

Conversation

Copilot AI commented Feb 19, 2026

Copy link
Copy Markdown

Accessing prev.images[0] and next.images[0] in the post navigation section throws a TypeError at runtime when a post's images field is absent.

Changes

  • layouts/PostLayout.js: Replace direct index access with optional chaining on prev/next image arrays
// Before
image={prev.images[0]}
image={next.images[0]}

// After
image={prev.images?.[0]}
image={next.images?.[0]}

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…Layout

Co-authored-by: qmauvnt <10303945+qmauvnt@users.noreply.github.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Feb 19, 2026

Copy link
Copy Markdown

Deploying vntechies-blog with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6a9b42c
Status: ✅  Deploy successful!
Preview URL: https://9201b9e4.blog-68k.pages.dev
Branch Preview URL: https://copilot-sub-pr-110-another-o.blog-68k.pages.dev

View logs

Copilot AI changed the title [WIP] WIP address feedback on vntechies v3 pull request Use optional chaining for post navigation image access in PostLayout Feb 19, 2026
Copilot AI requested a review from qmauvnt February 19, 2026 21:44
Base automatically changed from ui-v3 to main February 27, 2026 07:03
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