Skip to content

Commit

Permalink
style(pods-panel): Avoid no-result-page on switching connection
Browse files Browse the repository at this point in the history
  • Loading branch information
marhkb committed Oct 12, 2024
1 parent 354a54d commit de4b701
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions src/view/pods_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,17 +353,28 @@ mod imp {
view::PodRow::from(item.downcast_ref().unwrap()).upcast()
});

self.filter_stack
.set_visible_child_name(if model.n_items() > 0 { "list" } else { "empty" });
model.connect_items_changed(clone!(@weak obj => move |model, _, removed, _| {
obj.imp()
.filter_stack
.set_visible_child_name(if model.n_items() > 0 { "list" } else { "empty" });

if removed > 0 {
obj.deselect_hidden_pods(model.upcast_ref());
model.connect_items_changed(clone!(
#[weak]
obj,
move |model, _, removed, _| {
obj.imp().filter_stack.set_visible_child_name(
if model.n_items() > 0
|| !obj
.pod_list()
.as_ref()
.is_some_and(model::PodList::initialized)
{
"list"
} else {
"empty"
},
);

if removed > 0 {
obj.deselect_hidden_pods(model.upcast_ref());
}
}
}));
));

ACTIONS_SELECTION
.iter()
Expand Down

0 comments on commit de4b701

Please sign in to comment.