fix(handler): Fixed a bug in the movie details handler that would allow key events to be processed before the data was finished loading

This commit is contained in:
2024-11-06 16:17:23 -07:00
parent 0d8803d35d
commit 53ca14e64d
2 changed files with 85 additions and 30 deletions
@@ -47,18 +47,28 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for MovieDetailsHandler<
}
fn is_ready(&self) -> bool {
let movie_details_modal_is_ready =
if let Some(movie_details_modal) = &self.app.data.radarr_data.movie_details_modal {
!movie_details_modal.movie_details.is_empty()
|| !movie_details_modal.movie_history.is_empty()
|| !movie_details_modal.movie_cast.is_empty()
|| !movie_details_modal.movie_crew.is_empty()
|| !movie_details_modal.movie_releases.is_empty()
} else {
false
};
!self.app.is_loading && movie_details_modal_is_ready
if let Some(movie_details_modal) = &self.app.data.radarr_data.movie_details_modal {
match self.active_radarr_block {
ActiveRadarrBlock::MovieDetails => {
!self.app.is_loading && !movie_details_modal.movie_details.is_empty()
}
ActiveRadarrBlock::MovieHistory => {
!self.app.is_loading && !movie_details_modal.movie_history.is_empty()
}
ActiveRadarrBlock::Cast => {
!self.app.is_loading && !movie_details_modal.movie_cast.is_empty()
}
ActiveRadarrBlock::Crew => {
!self.app.is_loading && !movie_details_modal.movie_crew.is_empty()
}
ActiveRadarrBlock::ManualSearch => {
!self.app.is_loading && !movie_details_modal.movie_releases.is_empty()
}
_ => !self.app.is_loading,
}
} else {
false
}
}
fn handle_scroll_up(&mut self) {