[PR #5641] [MERGED] fix: prevent clear response action in response examples and test runner #5300

Closed
opened 2026-03-17 02:45:33 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/5641
Author: @nivedin
Created: 12/1/2025
Status: Merged
Merged: 12/2/2025
Merged by: @jamesgeorge007

Base: patchHead: fix/clear-response-bug


📝 Commits (4)

  • 6fa30db fix: clear response for request tab only
  • 37711b5 chore: hide clear response in test runner
  • e4b73be chore: make isTestRunner optional
  • 12bb7dc chore: fix comment

📊 Changes

9 files changed (+65 additions, -8 deletions)

View changed files

📝 packages/hoppscotch-common/src/components/lenses/ResponseBodyRenderer.vue (+1 -0)
📝 packages/hoppscotch-common/src/components/lenses/renderers/AudioLensRenderer.vue (+8 -1)
📝 packages/hoppscotch-common/src/components/lenses/renderers/HTMLLensRenderer.vue (+8 -1)
📝 packages/hoppscotch-common/src/components/lenses/renderers/ImageLensRenderer.vue (+8 -1)
📝 packages/hoppscotch-common/src/components/lenses/renderers/JSONLensRenderer.vue (+8 -1)
📝 packages/hoppscotch-common/src/components/lenses/renderers/PDFLensRenderer.vue (+8 -1)
📝 packages/hoppscotch-common/src/components/lenses/renderers/RawLensRenderer.vue (+8 -1)
📝 packages/hoppscotch-common/src/components/lenses/renderers/VideoLensRenderer.vue (+8 -1)
📝 packages/hoppscotch-common/src/components/lenses/renderers/XMLLensRenderer.vue (+8 -1)

📄 Description

Closes FE-1076

This PR fixes the issue where the app crashed when clearing the response from an example request. Now, it only clears the response of the request tab.

Follow-up of #5435.

What's changed

  • Added conditional guard to eraseResponse() function in all lens renderers
  • Response clearing now only executes when isEditable is false (main request tab)
  • Prevents unintended data loss from keyboard shortcuts in example requests

Notes to reviewers

N/A


Summary by cubic

Fixed a crash when clearing a response from an Example request by limiting clear to the Request tab and hiding Clear Response in Test Runner (FE-1076). Added guards to prevent clearing editable example or test-runner responses.

  • Bug Fixes
    • Gate eraseResponse with if (!props.isEditable && !props.isTestRunner) in Audio, HTML, Image, JSON, PDF, Raw, Video, and XML.

Written for commit 12bb7dc007. Summary will update automatically on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/5641 **Author:** [@nivedin](https://github.com/nivedin) **Created:** 12/1/2025 **Status:** ✅ Merged **Merged:** 12/2/2025 **Merged by:** [@jamesgeorge007](https://github.com/jamesgeorge007) **Base:** `patch` ← **Head:** `fix/clear-response-bug` --- ### 📝 Commits (4) - [`6fa30db`](https://github.com/hoppscotch/hoppscotch/commit/6fa30db7d9e16e6fb0bb8c41350ffde2aa343bdd) fix: clear response for request tab only - [`37711b5`](https://github.com/hoppscotch/hoppscotch/commit/37711b5fe4665d5a500c1e98338de711aa6951f0) chore: hide clear response in test runner - [`e4b73be`](https://github.com/hoppscotch/hoppscotch/commit/e4b73bef6c0d461a1448824a36e3a7fc12ffe1b3) chore: make isTestRunner optional - [`12bb7dc`](https://github.com/hoppscotch/hoppscotch/commit/12bb7dc00751d4697521348b69690d7d5d4da715) chore: fix comment ### 📊 Changes **9 files changed** (+65 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-common/src/components/lenses/ResponseBodyRenderer.vue` (+1 -0) 📝 `packages/hoppscotch-common/src/components/lenses/renderers/AudioLensRenderer.vue` (+8 -1) 📝 `packages/hoppscotch-common/src/components/lenses/renderers/HTMLLensRenderer.vue` (+8 -1) 📝 `packages/hoppscotch-common/src/components/lenses/renderers/ImageLensRenderer.vue` (+8 -1) 📝 `packages/hoppscotch-common/src/components/lenses/renderers/JSONLensRenderer.vue` (+8 -1) 📝 `packages/hoppscotch-common/src/components/lenses/renderers/PDFLensRenderer.vue` (+8 -1) 📝 `packages/hoppscotch-common/src/components/lenses/renderers/RawLensRenderer.vue` (+8 -1) 📝 `packages/hoppscotch-common/src/components/lenses/renderers/VideoLensRenderer.vue` (+8 -1) 📝 `packages/hoppscotch-common/src/components/lenses/renderers/XMLLensRenderer.vue` (+8 -1) </details> ### 📄 Description <!-- Thanks for creating this pull request 🤗 Please make sure that the pull request is limited to one type (docs, feature, etc.) and keep it as small as possible. You can open multiple prs instead of opening a huge one. --> <!-- If this pull request closes an issue, please mention the issue number below --> Closes FE-1076 This PR fixes the issue where the app crashed when clearing the response from an example request. Now, it only clears the response of the request tab. Follow-up of #5435. <!-- Add an introduction into what this PR tries to solve in a couple of sentences --> ### What's changed - Added conditional guard to eraseResponse() function in all lens renderers - Response clearing now only executes when isEditable is false (main request tab) - Prevents unintended data loss from keyboard shortcuts in example requests ### Notes to reviewers N/A <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixed a crash when clearing a response from an Example request by limiting clear to the Request tab and hiding Clear Response in Test Runner (FE-1076). Added guards to prevent clearing editable example or test-runner responses. - **Bug Fixes** - Gate eraseResponse with if (!props.isEditable && !props.isTestRunner) in Audio, HTML, Image, JSON, PDF, Raw, Video, and XML. <sup>Written for commit 12bb7dc00751d4697521348b69690d7d5d4da715. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 02:45:33 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#5300
No description provided.