Skip to content

Commit

Permalink
fix(tui): changing state on wrong element type doesn't crash anymore …
Browse files Browse the repository at this point in the history
…but simply logs error
  • Loading branch information
louis-thevenet committed Dec 23, 2024
1 parent 15304e9 commit 9d8f4c8
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/components/explorer_tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,20 +453,24 @@ impl Component for ExplorerTab<'_> {
self.search_bar_widget.is_focused = !self.search_bar_widget.is_focused;
}
Action::MarkDone => {
self.edit_selected_task_state(State::Done)?;
return Ok(Some(Action::ReloadVault));
if self.edit_selected_task_state(State::Done).is_ok() {
return Ok(Some(Action::ReloadVault));
}
}
Action::MarkCancel => {
self.edit_selected_task_state(State::Canceled)?;
return Ok(Some(Action::ReloadVault));
if self.edit_selected_task_state(State::Canceled).is_ok() {
return Ok(Some(Action::ReloadVault));
}
}
Action::MarkToDo => {
self.edit_selected_task_state(State::ToDo)?;
return Ok(Some(Action::ReloadVault));
if self.edit_selected_task_state(State::ToDo).is_ok() {
return Ok(Some(Action::ReloadVault));
}
}
Action::MarkIncomplete => {
self.edit_selected_task_state(State::Incomplete)?;
return Ok(Some(Action::ReloadVault));
if self.edit_selected_task_state(State::Incomplete).is_ok() {
return Ok(Some(Action::ReloadVault));
}
}
Action::Edit => {
if let Some(task) = self.get_selected_task() {
Expand Down

0 comments on commit 9d8f4c8

Please sign in to comment.