-
-
Notifications
You must be signed in to change notification settings - Fork 52
Add Plex Default Library to Settings and Update Related Components #1909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add Plex Default Library to Settings and Update Related Components #1909
Conversation
…ed components - Introduced `plex_default_library` property in SettingsService, SettingDto, and Settings entity. - Updated LibrarySwitcher and Overview components to utilize the default library setting when switching libraries. - Added a dropdown in PlexSettings for selecting the default library from available libraries.
…ettings, and settings-context components - Enhanced readability by adjusting line breaks and indentation in the LibrarySwitcher and Overview components. - Standardized formatting in PlexSettings and settings-context files for better consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new Plex default library setting that allows users to configure which library is automatically selected when visiting the overview page. The implementation includes database schema changes, UI components for configuration, and automatic library selection logic.
- Adds
plex_default_library
field to settings schema with proper migration - Introduces a UI dropdown in Plex settings for selecting default library from available options
- Updates Overview and LibrarySwitcher components to automatically use the configured default library
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
ui/src/contexts/settings-context.tsx |
Adds plex_default_library property to settings interface |
ui/src/components/Settings/Plex/index.tsx |
Implements UI dropdown for selecting default library with proper validation |
ui/src/components/Overview/index.tsx |
Updates library selection logic to use default library setting with fallback |
ui/src/components/Common/LibrarySwitcher/index.tsx |
Enhances library switching to respect default library configuration |
server/src/modules/settings/settings.service.ts |
Adds plex_default_library property to settings service |
server/src/modules/settings/entities/settings.entities.ts |
Defines database column for default library setting |
server/src/modules/settings/dto's/setting.dto.ts |
Adds plex_default_library to data transfer object |
server/src/database/migrations/1748211262583-Add_plex_default_library.ts |
Creates migration to add new column to settings table |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
plex_port: +portRef.current.value, | ||
plex_name: nameRef.current.value, | ||
plex_ssl: +sslRef.current.checked, // not used, server derives this from https:// | ||
plex_default_library: defaultLibraryRef.current?.value ? +defaultLibraryRef.current.value : undefined, |
Copilot
AI
Aug 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ternary operation converts empty string to undefined
, but the type should be consistent with the nullable database field. Consider using null
instead of undefined
for better consistency with the backend schema.
plex_default_library: defaultLibraryRef.current?.value ? +defaultLibraryRef.current.value : undefined, | |
plex_default_library: defaultLibraryRef.current?.value ? +defaultLibraryRef.current.value : null, |
Copilot uses AI. Check for mistakes.
|
||
plex_auth_token: string; | ||
|
||
plex_default_library: number; |
Copilot
AI
Aug 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DTO property should be nullable to match the database entity definition. The type should be number | null
instead of number
to properly represent optional values.
plex_default_library: number; | |
plex_default_library: number | null; |
Copilot uses AI. Check for mistakes.
|
||
plex_auth_token: string; | ||
|
||
plex_default_library: number; |
Copilot
AI
Aug 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The service property should be nullable to match the database entity and DTO. The type should be number | null
to properly handle cases where no default library is set.
plex_default_library: number; | |
plex_default_library: number | null; |
Copilot uses AI. Check for mistakes.
- Updated the plex_default_library property in SettingsService, SettingDto, and settings-context to accept null values, enhancing flexibility in settings configuration.
plex_default_library
property in SettingsService, SettingDto, and Settings entity.Description
Added a Plex default library setting that allows users to configure which library is automatically selected when visiting the overview page. This includes a new database column
plex_default_library
in the settings table, a UI setting in the Plex configuration to select the default library, and automatic library selection on the overview page using the configured default with fallback to the first available library if no default is set.The approach prioritizes backward compatibility and follows established patterns by adding the setting to the existing
settings
table as a nullable field, ensuring existing installations continue to work without breaking changes. The UI integration places the setting in the Plex configuration page where users expect to find Plex-related settings, and only shows the library dropdown when Plex is authenticated and libraries are available. The implementation updates both the Overview component and LibrarySwitcher to respect the default setting, ensuring consistency across all pages while maintaining the existing "All" option behavior for pages that need it. A proper TypeORM migration ensures clean deployment to existing installations following the established migration naming convention.Checklist
How to test
Please describe the steps to test your changes, including any setup required.