fix: make back button on settings page not count sidebar items (#730)

This commit is contained in:
Manor Dev 2026-08-25 16:44:08 +03:00 • committed by GitHub
parent f74ed38363
commit b00dff4256
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 6 deletions

View file

@ -65,8 +65,19 @@ impl Component for AnimatedAppOutlet {
fn render(&self) -> impl IntoElement {
let mut router = use_animated_router::<Route>();
let history = use_previous_and_current(use_route::<Route>());
let back_title = history.read().0.title();
let route = use_route::<Route>();
let mut origin_route = use_state(|| route.clone());
let mut last_route = use_state(|| route.clone());
use_side_effect_with_deps(&route, move |current| {
let prev = last_route.peek().clone();
if !(is_sidebar_route(&prev) && is_sidebar_route(current)) {
origin_route.set(prev);
}
last_route.set(current.clone());
});
let back_title = origin_route.read().title();
let anim = use_animation(|_conf| {
AnimNum::new(0., 1.)

View file

@ -204,8 +204,7 @@ const SEARCH_INDEX: &[SearchItem] = &[
title: "Free up space",
description: "Remove cached packages and leftovers nothing is using.",
keywords: &[
"storage", "clean", "cleanup", "free", "space", "cache", "unused", "orphan",
"leftover",
"storage", "clean", "cleanup", "free", "space", "cache", "unused", "orphan", "leftover",
],
route: Route::SettingsStorage {},
},
@ -576,7 +575,7 @@ fn search_results(query: &SearchQuery, mut search: State<String>) -> Vec<Element
.on_press(move |_| {
set_pending_setting_focus(id);
search.set(String::new());
let _ = RouterContext::get().push(route.clone());
let _ = RouterContext::get().replace(route.clone());
})
.child(Icon::new(item.icon))
.child(
@ -808,7 +807,7 @@ impl Component for SidebarItem {
})
.map(route, |el, route| {
el.on_all_press(move |_| {
let _ = RouterContext::get().push(route.clone());
let _ = RouterContext::get().replace(route.clone());
})
});