[GH-ISSUE #4308] [bug]: When deleting a request, tab to collection mapping comes out of sync. This causes the incorrect tab to be opened when selecting a request. #1567

Closed
opened 2026-03-16 20:52:47 +03:00 by kerem · 1 comment
Owner

Originally created by @samMolyneux on GitHub (Aug 29, 2024).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/4308

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

In the below video you can see that once 'Test 4' is deleted, selecting other requests in the collection causes the wrong tab to be brought into focus. For 'Test 1' a duplicate tab is created.

https://github.com/user-attachments/assets/ea99100e-30d8-4e06-bbd9-cfdb0456019e

This indicates that there is faulty logic in the tab reordering in resolveSaveContextOnRequestReorder in packages/hoppscotch-common/src/helpers/collection/request.ts which is triggered by the 'remove-request' event in hoppscotch-common/src/components/collections.

The tab => request mapping appears to be off by one when used for the delete, likely due to the code on line 29 not being executed for a delete (as newIndex is -1). This causes the tab relating to the request above the one selected to be opened. In the case of the first request, there is no tab with the matching index so a new tab is created.

Steps to reproduce

  1. Create a collection with multiple requests
  2. Open all requests in tabs
  3. Delete a request
  4. Select a different request in the collection via the collection view on the right of the screen
  5. Observe incorrect tab opening

Environment

Production

Version

Cloud

Originally created by @samMolyneux on GitHub (Aug 29, 2024). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/4308 ### Is there an existing issue for this? - [X] I have searched the existing issues ### Current behavior In the below video you can see that once 'Test 4' is deleted, selecting other requests in the collection causes the wrong tab to be brought into focus. For 'Test 1' a duplicate tab is created. https://github.com/user-attachments/assets/ea99100e-30d8-4e06-bbd9-cfdb0456019e This indicates that there is faulty logic in the tab reordering in `resolveSaveContextOnRequestReorder` in `packages/hoppscotch-common/src/helpers/collection/request.ts` which is triggered by the 'remove-request' event in `hoppscotch-common/src/components/collections`. The tab => request mapping appears to be off by one when used for the delete, likely due to the code on line 29 not being executed for a delete (as newIndex is -1). This causes the tab relating to the request above the one selected to be opened. In the case of the first request, there is no tab with the matching index so a new tab is created. ### Steps to reproduce 1. Create a collection with multiple requests 2. Open all requests in tabs 3. Delete a request 4. Select a different request in the collection via the collection view on the right of the screen 5. Observe incorrect tab opening ### Environment Production ### Version Cloud
kerem 2026-03-16 20:52:47 +03:00
Author
Owner

@anwarulislam commented on GitHub (Mar 19, 2025):

This issue cannot be reproduced now and may have been fixed. Therefore, I am closing it as completed.

<!-- gh-comment-id:2734982817 --> @anwarulislam commented on GitHub (Mar 19, 2025): This issue cannot be reproduced now and may have been fixed. Therefore, I am closing it as completed.
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#1567
No description provided.