From ea6aeb7b228b52d113a5a70f256ebb603cb443cb Mon Sep 17 00:00:00 2001 From: Adam Kelly Date: Sun, 17 Sep 2023 23:36:58 +0100 Subject: [PATCH] Resolving conflicts due to refactor --- packages/insomnia/src/common/import.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/insomnia/src/common/import.ts b/packages/insomnia/src/common/import.ts index 9fa4978a82d..2b68a763895 100644 --- a/packages/insomnia/src/common/import.ts +++ b/packages/insomnia/src/common/import.ts @@ -201,7 +201,14 @@ export const importResourcesToWorkspace = async ({ workspaceId }: { workspaceId: // Create new ids for each resource below optionalResources for (const resource of optionalResources) { const model = getModel(resource.type); - model && ResourceIdMap.set(resource._id, generateId(model.prefix)); + if (model) { + if (!resource._id) { + ResourceIdMap.set(resource._id, generateId(model.prefix)); + } else { + console.log('[Import Scan] Retaining ID: ', resource._id); + ResourceIdMap.set(resource._id, resource._id); + } + } } // Preserve optionalResource relationships @@ -298,7 +305,14 @@ const importResourcesToNewWorkspace = async (projectId: string, workspaceToImpor for (const resource of resourcesWithoutWorkspaceAndApiSpec) { const model = getModel(resource.type); - model && ResourceIdMap.set(resource._id, generateId(model.prefix)); + if (model) { + if (!resource._id) { + ResourceIdMap.set(resource._id, generateId(model.prefix)); + } else { + console.log('[Import Scan] Retaining ID: ', resource._id); + ResourceIdMap.set(resource._id, resource._id); + } + } } for (const resource of resourcesWithoutWorkspaceAndApiSpec) {