Skip to content

Commit

Permalink
fix: Media type selection not reflecting what is saved (#1444)
Browse files Browse the repository at this point in the history
Co-authored-by: ydkmlt84 <[email protected]>
  • Loading branch information
benscobie and ydkmlt84 authored Dec 20, 2024
1 parent 56fda5c commit 47a9651
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions ui/src/components/Rules/RuleGroup/AddModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,20 @@ const AddModal = (props: AddModal) => {
) ?? false

function updateLibraryId(value: string) {
setLibraryId(value)
const lib = LibrariesCtx.libraries.find(
(el: ILibrary) => +el.key === +value,
)

if (lib) {
setSelectedLibraryId(lib.key)
setSelectedLibrary(lib)
setSelectedType(
lib.type === 'movie'
? EPlexDataType.MOVIES.toString()
: EPlexDataType.SHOWS.toString(),
)
}

setRadarrSettingsId(undefined)
setSonarrSettingsId(undefined)
setArrOption(0)
Expand All @@ -147,11 +160,6 @@ const AddModal = (props: AddModal) => {
if (lib) {
setSelectedLibraryId(lib.key)
setSelectedLibrary(lib)
setSelectedType(
lib.type === 'movie'
? EPlexDataType.MOVIES.toString()
: EPlexDataType.SHOWS.toString(),
)
}
}

Expand Down

0 comments on commit 47a9651

Please sign in to comment.