[PR #2917] [MERGED] feat: active tab no longer resets after request #4136

Closed
opened 2026-03-17 01:42:05 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/2917
Author: @aitchnyu
Created: 2/3/2023
Status: Merged
Merged: 2/8/2023
Merged by: @AndrewBastin

Base: mainHead: feat-2080-refactor


📝 Commits (8)

  • 463aa38 feat: active tab no longer resets after request
  • fb038cd chore: convert modified components to setup
  • 6e6d67e chore: moved to localpersistence
  • 0dc9caf refactor: tighten the types for REST response components
  • afdccff refactor: renamed wrong name, simplified confusing logic
  • b468414 refactor: revert back tab remember mechanism to not use local storage
  • 0a1e428 refactor: update name to
  • 1fb56c5 chore: remove unhelpful comments

📊 Changes

6 files changed (+93 additions, -74 deletions)

View changed files

📝 packages/hoppscotch-common/src/components/http/Response.vue (+14 -22)
📝 packages/hoppscotch-common/src/components/http/ResponseMeta.vue (+3 -1)
📝 packages/hoppscotch-common/src/components/lenses/HeadersRenderer.vue (+2 -2)
📝 packages/hoppscotch-common/src/components/lenses/HeadersRendererEntry.vue (+2 -2)
📝 packages/hoppscotch-common/src/components/lenses/ResponseBodyRenderer.vue (+68 -45)
📝 packages/hoppscotch-common/src/helpers/types/HoppRESTResponse.ts (+4 -2)

📄 Description

Closes #2080

Intended to be follow up of https://github.com/hoppscotch/hoppscotch/pull/2915

Description

[Excerpt from #2915]
When the ResponseBodyRenderer component renders for each request, the active tab (json, raw etc) is always set to the first one. Users prefer if same tab is persisted. So I moved tab preferences from ResponseBodyRenderer to parent so it loads with previously opened tab.

ResponseBodyRenderer had response props of { type: Object, default: () => ({}) }. Updated to { type: Object as PropType<HoppRESTResponse> | null } instead.

Which uncovered that headers prop in HeadersRendererEntry.vue and header prop in HeadersRenderer.vue were wrongly given as HoppRESTHeader (it has key, value, active properties). Updated those to the HoppRESTResponseHeaderKV type.

In ResponseMeta.vue response prop was updated to HoppRESTResponse | null. Updated the code so tsc finds the null checks ok.

Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

Additional Information


🔄 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/2917 **Author:** [@aitchnyu](https://github.com/aitchnyu) **Created:** 2/3/2023 **Status:** ✅ Merged **Merged:** 2/8/2023 **Merged by:** [@AndrewBastin](https://github.com/AndrewBastin) **Base:** `main` ← **Head:** `feat-2080-refactor` --- ### 📝 Commits (8) - [`463aa38`](https://github.com/hoppscotch/hoppscotch/commit/463aa388d4f8a69ebfd24a2e557550a0f8c38e1b) feat: active tab no longer resets after request - [`fb038cd`](https://github.com/hoppscotch/hoppscotch/commit/fb038cd54563c5b54601ff12395597c6d054633c) chore: convert modified components to setup - [`6e6d67e`](https://github.com/hoppscotch/hoppscotch/commit/6e6d67e6564d3fdc760aeebe35146f731bf2c216) chore: moved to localpersistence - [`0dc9caf`](https://github.com/hoppscotch/hoppscotch/commit/0dc9cafb9d55b17e2a023ab42ea7bb942ace09cb) refactor: tighten the types for REST response components - [`afdccff`](https://github.com/hoppscotch/hoppscotch/commit/afdccff3d7854b7991cff7f825605e5602fba85f) refactor: renamed wrong name, simplified confusing logic - [`b468414`](https://github.com/hoppscotch/hoppscotch/commit/b4684149be6672d84a8a57e7bccce605c0b8dcd8) refactor: revert back tab remember mechanism to not use local storage - [`0a1e428`](https://github.com/hoppscotch/hoppscotch/commit/0a1e428d5145d3c1ab1232f40e838e20a9b6f6fa) refactor: update name to - [`1fb56c5`](https://github.com/hoppscotch/hoppscotch/commit/1fb56c57d192e40013abc1a5a8fcd4c0a3f9f81b) chore: remove unhelpful comments ### 📊 Changes **6 files changed** (+93 additions, -74 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-common/src/components/http/Response.vue` (+14 -22) 📝 `packages/hoppscotch-common/src/components/http/ResponseMeta.vue` (+3 -1) 📝 `packages/hoppscotch-common/src/components/lenses/HeadersRenderer.vue` (+2 -2) 📝 `packages/hoppscotch-common/src/components/lenses/HeadersRendererEntry.vue` (+2 -2) 📝 `packages/hoppscotch-common/src/components/lenses/ResponseBodyRenderer.vue` (+68 -45) 📝 `packages/hoppscotch-common/src/helpers/types/HoppRESTResponse.ts` (+4 -2) </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 #2080 Intended to be follow up of https://github.com/hoppscotch/hoppscotch/pull/2915 ### Description <!-- Add a brief description of the pull request --> [Excerpt from #2915] When the ResponseBodyRenderer component renders for each request, the active tab (json, raw etc) is always set to the first one. Users prefer if same tab is persisted. So I moved tab preferences from ResponseBodyRenderer to parent so it loads with previously opened tab. ResponseBodyRenderer had response props of `{ type: Object, default: () => ({}) }`. Updated to `{ type: Object as PropType<HoppRESTResponse> | null }` instead. Which uncovered that `headers` prop in `HeadersRendererEntry.vue` and `header` prop in `HeadersRenderer.vue` were wrongly given as `HoppRESTHeader` (it has key, value, active properties). Updated those to the `HoppRESTResponseHeaderKV` type. In `ResponseMeta.vue` response prop was updated to `HoppRESTResponse | null`. Updated the code so tsc finds the null checks ok. <!-- You can also choose to add a list of changes and if they have been completed or not by using the markdown to-do list syntax - [ ] Not Completed - [x] Completed --> ### Checks <!-- Make sure your pull request passes the CI checks and do check the following fields as needed - --> - [x] My pull request adheres to the code style of this project - [ ] My code requires changes to the documentation - [ ] I have updated the documentation as required - [x] All the tests have passed ### Additional Information <!-- Any additional information like breaking changes, dependencies added, screenshots, comparisons between new and old behaviour, etc. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 01:42:05 +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#4136
No description provided.