Skip to content

Fix next/prev lesson navigation always pointing to Welcome#5

Merged
thomasahle merged 1 commit intothomasnormal:mainfrom
PaoloRondot:fix/next-lesson-navigation
Apr 7, 2026
Merged

Fix next/prev lesson navigation always pointing to Welcome#5
thomasahle merged 1 commit intothomasnormal:mainfrom
PaoloRondot:fix/next-lesson-navigation

Conversation

@PaoloRondot
Copy link
Copy Markdown
Contributor

Summary

  • The prev/next lesson buttons at the bottom of each lesson page always pointed to "Welcome"
  • indexOf(lesson) used reference equality, but lesson is a spread copy created in +page.js ({ ...lesson, ...content }), so it always returned -1 — and -1 + 1 = 0 resolved to the first lesson
  • Replaced with findIndex using slug matching

Test plan

  • Navigate to any lesson and verify the "next" button shows the correct next lesson title
  • Verify the "previous" button shows the correct previous lesson title
  • Verify first lesson has no "previous" button and last lesson has no "next" button

🤖 Generated with Claude Code

indexOf(lesson) used reference equality, but lesson is a spread copy
created in +page.js, so it always returned -1. Use findIndex with
slug matching instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@thomasahle thomasahle merged commit 943855c into thomasnormal:main Apr 7, 2026
0 of 2 checks passed
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