Skip to content

Commit c950995

Browse files
authored
Fix duplicate request snapshotting URL as name (#429)
1 parent 929f620 commit c950995

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

crates/yaak-models/guest-js/store.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,10 @@ export function duplicateModel<M extends AnyModel["model"], T extends ExtractMod
144144
throw new Error("Failed to duplicate null model");
145145
}
146146

147-
// If the model has a name, try to duplicate it with a name that doesn't conflict
148-
let name = "name" in model ? resolvedModelName(model) : undefined;
149-
if (name != null) {
147+
// If the model has an explicit (non-empty) name, try to duplicate it with a name that doesn't conflict.
148+
// When the name is empty, keep it empty so the display falls back to the URL.
149+
let name = "name" in model ? model.name : undefined;
150+
if (name) {
150151
const existingModels = listModels(model.model);
151152
for (let i = 0; i < 100; i++) {
152153
const hasConflict = existingModels.some((m) => {

0 commit comments

Comments
 (0)