Skip to content

Improve PlayButton with Preferences and Error Handling; Fix Manual Route Param Handling#561

Merged
prayag17 merged 3 commits into
prayag17:mainfrom
DavideSirico:main
Sep 22, 2025
Merged

Improve PlayButton with Preferences and Error Handling; Fix Manual Route Param Handling#561
prayag17 merged 3 commits into
prayag17:mainfrom
DavideSirico:main

Conversation

@DavideSirico
Copy link
Copy Markdown
Contributor

This pull request introduces enhancements to the PlayButton component in src/components/buttons/playButton.tsx, focusing on user preferences for subtitles and audio, improved handling of series episodes, and better error handling. Additionally, there is a minor fix in the manual.tsx route to handle undefined search parameters gracefully.

Enhancements to PlayButton functionality:

  • Subtitle and audio preferences support:

    • Integrated user preferences for subtitle and audio languages by fetching the current user's configuration using getUserApi. The preferred subtitle and audio tracks are now selected based on these preferences, with fallbacks to default or first available options.
  • Improved handling of series episodes:

    • Refactored the iconOnly condition to ensure proper handling of series episodes by dynamically determining the current episode ID. This includes disabling the button when no episodes are available or when data is still loading.
    • Updated the button label logic to display appropriate messages such as "Loading..." or "No episodes to watch found" when applicable.
  • Error handling improvements:

    • Added checks to prevent runtime errors when accessing nested properties of currentEpisode.data. This includes null-safe access to properties like Items, IndexNumber, and PlaybackPositionTicks.

Minor fix in manual.tsx:

  • Graceful handling of undefined search parameters:
    • Updated the validateSearch function in src/routes/_api/login/manual.tsx to handle cases where search.redirect is undefined, ensuring the return value is either a string or undefined instead of throwing an error.

@prayag17 prayag17 merged commit 07522b5 into prayag17:main Sep 22, 2025
1 of 4 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