Skip to content

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

fix(common): prevent duplication of request ID when duplicating requests (#5781)

Anwarul Islam194c9496aaf3
diff --git a/packages/hoppscotch-common/src/components/collections/graphql/index.vue b/packages/hoppscotch-common/src/components/collections/graphql/index.vue
index 7577b1213..cd454fc36 100644
--- a/packages/hoppscotch-common/src/components/collections/graphql/index.vue
+++ b/packages/hoppscotch-common/src/components/collections/graphql/index.vue
@@ -512,8 +512,9 @@ const duplicateRequest = async ({
}) => {
const isValidToken = await handleTokenValidation()
if (!isValidToken) return
+ const { id: _, ...requestWithoutID } = request
saveGraphqlRequestAs(folderPath, {
- ...cloneDeep(request),
+ ...cloneDeep(requestWithoutID),
name: `${request.name} - ${t("action.duplicate")}`,
})
}
diff --git a/packages/hoppscotch-common/src/components/collections/index.vue b/packages/hoppscotch-common/src/components/collections/index.vue
index 6a25a51f7..f0771c372 100644
--- a/packages/hoppscotch-common/src/components/collections/index.vue
+++ b/packages/hoppscotch-common/src/components/collections/index.vue
@@ -1564,8 +1564,9 @@ const duplicateRequest = async (payload: {
const { folderPath, request } = payload
if (!folderPath) return
+ const { id: _, ...requestWithoutID } = request
const newRequest = {
- ...cloneDeep(request),
+ ...cloneDeep(requestWithoutID),
_ref_id: generateUniqueRefId("req"),
name: `${request.name} - ${t("action.duplicate")}`,
}