From e64520f727f64c622061d859c7fe3273b103c03a Mon Sep 17 00:00:00 2001 From: Kartik Nayak Date: Fri, 4 Oct 2024 03:02:09 +0530 Subject: [PATCH] fix(sidebar): prevent duplicate entries of the same item --- src/app.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app.rs b/src/app.rs index db0a8e7..0bf3e20 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1352,7 +1352,10 @@ impl Application for App { Message::AddToSidebar(entity_opt) => { let mut favorites = self.config.favorites.clone(); for path in self.selected_paths(entity_opt) { - favorites.push(Favorite::from_path(path)); + let favorite = Favorite::from_path(path); + if !favorites.iter().any(|f| f == &favorite) { + favorites.push(favorite); + } } config_set!(favorites, favorites); return self.update_config();