mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 16:55:59 +03:00
[PR #5842] [MERGED] fix(common): resolve TypeError when opening request from search results #5377
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#5377
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hoppscotch/hoppscotch/pull/5842
Author: @Leon-Luu
Created: 2/5/2026
Status: ✅ Merged
Merged: 2/24/2026
Merged by: @jamesgeorge007
Base:
next← Head:fix_search_auth_issue📝 Commits (2)
b6ed8cefix: typeerror when open request from search resultsed48261fix(common): mark team collection data fields as optional in type casts📊 Changes
2 files changed (+13 additions, -13 deletions)
View changed files
📝
packages/hoppscotch-common/src/helpers/teams/TeamsSearch.service.ts(+10 -10)📝
packages/hoppscotch-common/src/services/team-collection.service.ts(+3 -3)📄 Description
In
packages/hoppscotch-common/src/helpers/teams/TeamsSearch.service.ts, thefindInheritableParentAuthmethod attempts to access theauthTypeproperty oninheritedAuthwithout first verifying thatinheritedAuthis defined.Problematic code:
When a parent collection has
nullorundefinedauth data in its parsed JSON,parentInheritedData.authwill beundefined, causing the error when trying to access.authType.Solution
Add a null/undefined check before accessing the
authTypeproperty:Impact
Closes https://github.com/hoppscotch/hoppscotch/issues/5841
Whats changed
Modified
packages/hoppscotch-common/src/helpers/teams/TeamsSearch.service.tsline 414 to include a null check before accessing theauthTypeproperty.Extended the fix to mark auth, headers, and variables as optional in all three JSON.parse type casts across
findInheritableParentAuth,findInheritableParentHeaders, andfindInheritableParentVariables.TeamCollection.datais a nullable JSON with no enforced shape on the backend, and older collections may be missing any of these fields. The existing truthy guards already handled this defensively — the casts now accurately reflect the actual runtime contract—same fix applied tocascadeParentCollectionForPropertiesinteam-collection.service.ts.Notes to reviewers
Tested OK
Summary by cubic
Fixed a crash when opening requests from search results by safely handling missing auth in team collection search. Updated TeamCollection.data type casts to mark auth/headers/variables as optional and added null checks before reading authType, preventing TypeErrors when parent collections lack these fields.
Written for commit
ed4826181e. Summary will update on new commits.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.