From 1942972db313868e809fac497f4bd122b78a4302 Mon Sep 17 00:00:00 2001 From: Ben Scobie Date: Wed, 18 Dec 2024 00:42:31 +0000 Subject: [PATCH] fix: Media type selection not reflecting what is saved --- .../Rules/RuleGroup/AddModal/index.tsx | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/ui/src/components/Rules/RuleGroup/AddModal/index.tsx b/ui/src/components/Rules/RuleGroup/AddModal/index.tsx index 093dfae5..3c83dc35 100644 --- a/ui/src/components/Rules/RuleGroup/AddModal/index.tsx +++ b/ui/src/components/Rules/RuleGroup/AddModal/index.tsx @@ -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) @@ -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(), - ) } }