From 574f0142f912feb82402c342d1589eeea033bac7 Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Mon, 6 May 2024 11:32:34 +0200 Subject: [PATCH] sort projects list alphabetically by title --- crates/gitbutler-core/src/projects/storage.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/gitbutler-core/src/projects/storage.rs b/crates/gitbutler-core/src/projects/storage.rs index eda39add5..ce758fef4 100644 --- a/crates/gitbutler-core/src/projects/storage.rs +++ b/crates/gitbutler-core/src/projects/storage.rs @@ -51,7 +51,7 @@ impl Storage { match self.inner.read(PROJECTS_FILE)? { Some(projects) => { let all_projects: Vec = serde_json::from_str(&projects)?; - let all_projects: Vec = all_projects + let mut all_projects: Vec = all_projects .into_iter() .map(|mut p| { // backwards compatibility for description field @@ -63,6 +63,9 @@ impl Storage { p }) .collect(); + + all_projects.sort_by(|a, b| a.title.cmp(&b.title)); + Ok(all_projects) } None => Ok(vec![]),