Kong / Kong/insomnia

Local exports always store the whole folder structure

Open
#9,482 2 comments 0 reactions 0 assignees View on GitHub
B-bug S-unverified
Dominant language
TypeScript
Stars
40k
Forks
2.4k
Avg merge
2d 13h
Merged PRs (30d)
61

Description

### Expected Behavior

When exporting only an explicitly selected subset of requests the resulting yaml file should contain only the folders that are ancestors of the selected requests.

### Actual Behavior

Exported files always store every folder present in the scratchpad

### Reproduction Steps

1. Create a project structure with multiple folders

Image

2. Go to 'Scratch Pad > Export'
3. In 'Export requests' select only one request (i.e. 'Leaf A') and press 'Export'
Image
4. Keep export format as 'Insomnia v5' and press 'Done'
5. Observe that yaml file contains info for all the folder created in step 1
5b. Delete every folder/request from scratchpad and reimport yaml file created in step 4 and observe that this created empty folders with no requests:

Image

### Is there an existing issue for this?

- [x] I have searched the [issue tracker](https://www.github.com/Kong/insomnia/issues) for this problem.

### Which sync method do you use?

- [ ] Git sync.
- [ ] Insomnia Cloud sync.
- [x] Local only

### Additional Information

This is arguably working as expected as users can attach scripts to folders and generally speaking someone might structure their requests in such a way that they rely on side effects from scripts from folders not directly related to said requests.

I would argue that inability to export individual folders forces users to ALWAYS export the whole scratchpad because otherwise it's up to user to manually merge current content of their scratchpad with whatever they just imported from the yaml file (e.g. if you don't delete everything in step 5b above you'll end up with duplicates of each folder)

Possible solutions?:
1. Export only folder's that are ascendants of selected requests.
3. Allow the users explicitly select folders in the export dialog (not just infer what folder to include based no selected requests)
4. Maybe change import such that merges folder based on their names?

### Insomnia Version

Latest version from github

### What operating system are you using?

Ubuntu

### Operating System Version

Ubuntu 24.04.3 LTS

### Installation method

Built from sources

### Last Known Working Insomnia version

N/A

Contributor guide

Open the contributing guide

Research direction

No source files or tests are named. Start by tracing the Scratch Pad > Export flow and how selected requests become the exported folder structure; reproduce the single-request case from the issue. Done means exporting selected requests includes only their ancestor folders and does not recreate unrelated empty folders.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.