Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

refactor: better name for duplicated environment

liyasthomasd83269054897
diff --git a/packages/hoppscotch-app/newstore/environments.ts b/packages/hoppscotch-app/newstore/environments.ts
index 8017a7225..02f12f30d 100644
--- a/packages/hoppscotch-app/newstore/environments.ts
+++ b/packages/hoppscotch-app/newstore/environments.ts
@@ -87,12 +87,14 @@ const dispatchers = defineDispatchers({
environments,
}
}
+ const index =
+ environments.filter((env) => env.name === newEnvironment.name).length + 1
return {
environments: [
...environments,
{
...cloneDeep(newEnvironment),
- name: `Duplicate of ${newEnvironment.name}`,
+ name: `${newEnvironment.name} ${index}`,
},
],
}