[PR #5255] fix(attachments): persist REST request attachments after reload (#4301) #5130

Open
opened 2026-03-17 02:36:16 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/5255
Author: @SHENIPRASHANTH
Created: 7/18/2025
Status: 🔄 Open

Base: mainHead: fix/4301-attachment-persistence


📝 Commits (1)

  • 265c234 fix(attachments): persist REST request attachments after reload (#4301)

📊 Changes

1 file changed (+38 additions, -17 deletions)

View changed files

📝 packages/hoppscotch-common/src/helpers/collection/request.ts (+38 -17)

📄 Description

What this PR does

This PR fixes issue #4301 by ensuring that REST request attachments are persisted in localStorage, even after the request list is reloaded or reordered.

Changes Made

  • Introduced persistAttachments() and loadPersistedAttachments() methods to handle attachment storage using localStorage.
  • Updated the resolveSaveContextOnRequestReorder() function to save attachments associated with the REST request before reordering or removing.
  • Ensured attachment persistence is tied to either requestID or fallback to request.name.

Why is this needed?

Previously, attachments added to REST requests were lost after refreshing the tab or reordering the requests in the user collection. This change ensures a better user experience by persisting these attachments.

Testing Instructions

  1. Add an attachment to any REST request.
  2. Reload the page or reorder the requests.
  3. Verify that the attachment still persists.

Let me know if you'd like to also add unit tests or update documentation for this feature.


🔄 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/5255 **Author:** [@SHENIPRASHANTH](https://github.com/SHENIPRASHANTH) **Created:** 7/18/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/4301-attachment-persistence` --- ### 📝 Commits (1) - [`265c234`](https://github.com/hoppscotch/hoppscotch/commit/265c2349b7f50c9c8d0273c3d912ac24733a395b) fix(attachments): persist REST request attachments after reload (#4301) ### 📊 Changes **1 file changed** (+38 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-common/src/helpers/collection/request.ts` (+38 -17) </details> ### 📄 Description ### What this PR does This PR fixes issue #4301 by ensuring that REST request attachments are persisted in localStorage, even after the request list is reloaded or reordered. ### Changes Made - Introduced `persistAttachments()` and `loadPersistedAttachments()` methods to handle attachment storage using `localStorage`. - Updated the `resolveSaveContextOnRequestReorder()` function to save attachments associated with the REST request before reordering or removing. - Ensured attachment persistence is tied to either `requestID` or fallback to `request.name`. ### Why is this needed? Previously, attachments added to REST requests were lost after refreshing the tab or reordering the requests in the user collection. This change ensures a better user experience by persisting these attachments. ### Testing Instructions 1. Add an attachment to any REST request. 2. Reload the page or reorder the requests. 3. Verify that the attachment still persists. --- Let me know if you'd like to also add unit tests or update documentation for this feature. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#5130
No description provided.