From 77e420dc6a3c3740bdcaf72ec1cc64522b4bd532 Mon Sep 17 00:00:00 2001 From: Leonic <88329746+Leon-Luu@users.noreply.github.com> Date: Tue, 24 Feb 2026 10:48:13 +0100 Subject: [PATCH] fix(common): resolve TypeError when opening request from search results (#5842) Co-authored-by: James George <25279263+jamesgeorge007@users.noreply.github.com> --- .../src/helpers/teams/TeamsSearch.service.ts | 20 +++++++++---------- .../src/services/team-collection.service.ts | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/hoppscotch-common/src/helpers/teams/TeamsSearch.service.ts b/packages/hoppscotch-common/src/helpers/teams/TeamsSearch.service.ts index 9acbf0d2..4d75a395 100644 --- a/packages/hoppscotch-common/src/helpers/teams/TeamsSearch.service.ts +++ b/packages/hoppscotch-common/src/helpers/teams/TeamsSearch.service.ts @@ -404,14 +404,14 @@ export class TeamSearchService extends Service { // has inherited data if (collection.data) { const parentInheritedData = JSON.parse(collection.data) as { - auth: HoppRESTAuth - headers: HoppRESTHeader[] - variables: HoppCollectionVariable[] + auth?: HoppRESTAuth + headers?: HoppRESTHeader[] + variables?: HoppCollectionVariable[] } const inheritedAuth = parentInheritedData.auth - if (inheritedAuth.authType !== "inherit") { + if (inheritedAuth && inheritedAuth.authType !== "inherit") { return E.right({ parentID: collectionID, parentName: collection.title, @@ -448,9 +448,9 @@ export class TeamSearchService extends Service { // see if it has headers to inherit, if yes, add it to the existing headers if (collection.data) { const parentInheritedData = JSON.parse(collection.data) as { - auth: HoppRESTAuth - headers: HoppRESTHeader[] - variables: HoppCollectionVariable[] + auth?: HoppRESTAuth + headers?: HoppRESTHeader[] + variables?: HoppCollectionVariable[] } const inheritedHeaders = parentInheritedData.headers @@ -494,9 +494,9 @@ export class TeamSearchService extends Service { if (collection.data) { const parentData = JSON.parse(collection.data) as { - auth: HoppRESTAuth - headers: HoppRESTHeader[] - variables: HoppCollectionVariable[] + auth?: HoppRESTAuth + headers?: HoppRESTHeader[] + variables?: HoppCollectionVariable[] } const variables = parentData.variables diff --git a/packages/hoppscotch-common/src/services/team-collection.service.ts b/packages/hoppscotch-common/src/services/team-collection.service.ts index dd47b04d..9daad0bb 100644 --- a/packages/hoppscotch-common/src/services/team-collection.service.ts +++ b/packages/hoppscotch-common/src/services/team-collection.service.ts @@ -1144,9 +1144,9 @@ export class TeamCollectionsService extends Service { } const data: { - auth: HoppRESTAuth - headers: HoppRESTHeader[] - variables: HoppCollectionVariable[] + auth?: HoppRESTAuth + headers?: HoppRESTHeader[] + variables?: HoppCollectionVariable[] } = parentFolder.data ? JSON.parse(parentFolder.data) : {