From d83269054897c80f9fa08683b438ff044e3c3b72 Mon Sep 17 00:00:00 2001 From: liyasthomas Date: Sun, 3 Oct 2021 18:53:27 +0530 Subject: [PATCH] refactor: better name for duplicated environment --- packages/hoppscotch-app/newstore/environments.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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}`, }, ], }