Repository navigation
Conversation
Kombustor
force-pushed
the
fix/various-bugs-and-issues
branch
from
September 13, 2026 21:40
ef5b59d to
7747cb6
Compare
Comment on lines
+784
to
+793
| const handleChapterNavigate = useCallback( | ||
| (direction: 'left' | 'right', currentChapter: VideoChapter) => { | ||
| const chapterIndex = chapters?.findIndex( | ||
| (chapter) => | ||
| chapter.startTime === currentChapter.startTime && | ||
| chapter.endTime === currentChapter.endTime | ||
| ); | ||
| if (chapterIndex === undefined || chapterIndex < 0) return; | ||
|
|
||
| const nextChapterIndex = chapterIndex + (direction === 'right' ? 1 : -1); |
There was a problem hiding this comment.
Bug: Chapter navigation on TV can call onSeek(NaN) if adjacent chapter data is invalid, potentially crashing the player or corrupting watch history.
Severity: HIGH
Suggested Fix
The handleChapterNavigate function should use the same filtered list of valid chapters that the UI uses for navigation, rather than the raw chapters prop. Alternatively, explicitly validate that nextChapter.startTime is a finite number before calling onSeek.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: src/components/video/PlayerControls.tsx#L784-L793
Potential issue: The `handleChapterNavigate` function, used for TV d-pad navigation,
identifies the current chapter within the raw, unfiltered `chapters` array. It then
attempts to navigate to the adjacent chapter in that same raw array. If the video source
provides malformed metadata where an adjacent chapter has an invalid `startTime` (e.g.,
`NaN`), the function will call `onSeek` with this invalid value. This can lead to a
native player crash or corruption of the user's watch history by persisting `NaN` as the
progress.
Also affects:
src/components/video/ChapterLabel.tsx:1~296
Did we get this right? 👍 / 👎 to inform future reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.