fix: Fixed a bug in all Servarr implementations to not try to get the current selection of a search table when an error is returned from the API
This commit is contained in:
@@ -272,6 +272,10 @@ impl HorizontallyScrollableText {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.text.is_empty()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||
|
||||
@@ -176,6 +176,11 @@ mod tests {
|
||||
assert_str_eq!(horizontally_scrollable_text.text, test_text);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_horizontally_scrollable_text_is_empty() {
|
||||
assert_is_empty!(HorizontallyScrollableText::from(""))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_horizontally_scrollable_text_scroll_text_left() {
|
||||
let horizontally_scrollable_text = HorizontallyScrollableText::from("Test string");
|
||||
|
||||
@@ -70,7 +70,7 @@ impl DrawUi for AddMovieUi {
|
||||
fn draw_add_movie_search(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
let is_loading = app.is_loading || app.data.radarr_data.add_searched_movies.is_none();
|
||||
let current_selection =
|
||||
if let Some(add_searched_movies) = app.data.radarr_data.add_searched_movies.as_ref() {
|
||||
if let Some(add_searched_movies) = app.data.radarr_data.add_searched_movies.as_ref() && app.error.is_empty() {
|
||||
add_searched_movies.current_selection().clone()
|
||||
} else {
|
||||
AddMovieSearchResult::default()
|
||||
|
||||
@@ -65,7 +65,7 @@ impl DrawUi for AddSeriesUi {
|
||||
fn draw_add_series_search(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
let is_loading = app.is_loading || app.data.sonarr_data.add_searched_series.is_none();
|
||||
let current_selection =
|
||||
if let Some(add_searched_series) = app.data.sonarr_data.add_searched_series.as_ref() {
|
||||
if let Some(add_searched_series) = app.data.sonarr_data.add_searched_series.as_ref() && app.error.is_empty() {
|
||||
add_searched_series.current_selection().clone()
|
||||
} else {
|
||||
AddSeriesSearchResult::default()
|
||||
|
||||
Reference in New Issue
Block a user