fix: activate nav bar item with matching location

This commit is contained in:
Michael Aaron Murphy 2024-06-02 13:55:23 +02:00 committed by Jeremy Soller
parent 4a7c59b987
commit 5aaff9ea3b

View file

@ -1628,6 +1628,18 @@ impl Application for App {
commands.push(self.update(action.message(Some(entity))));
}
tab::Command::ChangeLocation(tab_title, tab_path) => {
// Activate nav bar item with matching location.
let nav_bar_id = self.nav_model.iter().find(|&id| {
self.nav_model
.data::<Location>(id)
.map(|location| &tab_path == location)
.unwrap_or_default()
});
if let Some(id) = nav_bar_id {
self.nav_model.activate(id);
}
self.tab_model.text_set(entity, tab_title);
commands.push(Command::batch([
self.update_title(),