From cdc034b25a857422b775ba7747f117cb922d110e Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Tue, 8 Sep 2026 08:51:42 -0700 Subject: [PATCH] fix(import): parenthesize the number on a taken workspace name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "Name 2" reads as part of the name; "Name (2)" reads as the second one. The destination row leads with "New workspace ·" rather than trailing a second parenthetical after it. Co-Authored-By: Claude Opus 5 --- apps/yaak-client/components/ImportDataDialog.tsx | 2 +- crates/yaak/src/import.rs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/yaak-client/components/ImportDataDialog.tsx b/apps/yaak-client/components/ImportDataDialog.tsx index 60819840..facb8047 100644 --- a/apps/yaak-client/components/ImportDataDialog.tsx +++ b/apps/yaak-client/components/ImportDataDialog.tsx @@ -312,7 +312,7 @@ function LoadedImportDataDialog({ if (plan.destination.type === "new_workspace") { const names = plan.resources.workspaces.map((w) => w.name).filter((n) => n !== ""); if (names.length > 1) return pluralizeCount("new workspace", names.length); - return names[0] == null ? "New workspace" : `${names[0]} (new workspace)`; + return names[0] == null ? "New workspace" : `New workspace · ${names[0]}`; } const { workspaceId, folderId } = plan.destination; const name = workspaces.find((w) => w.id === workspaceId)?.name ?? "Unknown workspace"; diff --git a/crates/yaak/src/import.rs b/crates/yaak/src/import.rs index b6e3461a..d704fd67 100644 --- a/crates/yaak/src/import.rs +++ b/crates/yaak/src/import.rs @@ -1251,7 +1251,7 @@ fn unique_name(name: &str, taken: &[String]) -> String { } let mut n = 2; loop { - let candidate = format!("{name} {n}"); + let candidate = format!("{name} ({n})"); if !taken.iter().any(|t| *t == candidate) { return candidate; } @@ -1683,13 +1683,13 @@ mod tests { None, ) .expect("plan second import"); - assert_eq!(second.resources.workspaces[0].name, "Imported 2"); + assert_eq!(second.resources.workspaces[0].name, "Imported (2)"); let warning = second .warnings .iter() .find(|w| w.title == "Workspace renamed") .expect("the rename is explained"); - assert_eq!(warning.detail, "Imported → Imported 2 · that name is taken"); + assert_eq!(warning.detail, "Imported → Imported (2) · that name is taken"); commit_import_plan(&query_manager, second).expect("commit second import"); let third = plan_import_resources( @@ -1701,7 +1701,7 @@ mod tests { None, ) .expect("plan third import"); - assert_eq!(third.resources.workspaces[0].name, "Imported 3"); + assert_eq!(third.resources.workspaces[0].name, "Imported (3)"); let names = query_manager .connect() @@ -1711,7 +1711,7 @@ mod tests { .map(|w| w.name) .filter(|name| name.starts_with("Imported")) .collect::>(); - assert_eq!(names, BTreeSet::from(["Imported".to_string(), "Imported 2".to_string()])); + assert_eq!(names, BTreeSet::from(["Imported".to_string(), "Imported (2)".to_string()])); } #[test]