fix(app): close selected preview on single click

set context_page to preview with Some(entity) instead of None when "Show
details" is selected.

Preview of None entity would fail first equality check in
Message::ToggleContextPage as `Preview(None, ..) != Preview(Some, ..)`
.

This fixes the two clicks needed to close Preview of Selected as first
click would update self.context_page from Preview(None,..) to
Preview(Some,..) and next click would pass equality and close Preview.
This commit is contained in:
Shehriyar Qureshi 2025-03-04 14:50:54 +05:00
parent c8aa80fb2f
commit b25d0b5ff7

View file

@ -2704,7 +2704,7 @@ impl Application for App {
match self.mode {
Mode::App => {
let show_details = !self.config.show_details;
self.context_page = ContextPage::Preview(None, PreviewKind::Selected);
self.context_page = ContextPage::Preview(entity_opt, PreviewKind::Selected);
self.core.window.show_context = show_details;
return cosmic::task::message(Message::SetShowDetails(show_details));
}