[PR #4336] [MERGED] fix: ensure cross-platform compatibility with file exports #4756

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

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/4336
Author: @jamesgeorge007
Created: 9/9/2024
Status: Merged
Merged: 9/10/2024
Merged by: @AndrewBastin

Base: patchHead: fix/platform-based-file-export


📝 Commits (1)

  • 7f7c05d fix: ensure cross-platform compatibility with file exports

📊 Changes

8 files changed (+116 additions, -109 deletions)

View changed files

📝 packages/hoppscotch-common/src/components/collections/ImportExport.vue (+20 -13)
📝 packages/hoppscotch-common/src/components/collections/graphql/ImportExport.vue (+4 -4)
📝 packages/hoppscotch-common/src/components/environments/ImportExport.vue (+24 -26)
📝 packages/hoppscotch-common/src/components/environments/my/Environment.vue (+8 -4)
📝 packages/hoppscotch-common/src/components/environments/teams/Environment.vue (+7 -4)
📝 packages/hoppscotch-common/src/helpers/import-export/export/environment.ts (+19 -30)
📝 packages/hoppscotch-common/src/helpers/import-export/export/index.ts (+23 -19)
📝 packages/hoppscotch-common/src/platform/std/io.ts (+11 -9)

📄 Description

This PR enforces the usage of platform-based API for file exports ensuring compatibility across web and Desktop apps. This accounts for export flows related to collections (REST/GQL) & environments.

Closes #4332 HFE-578.

What's changed

  • The initializeDownloadCollection() helper function is renamed to initializeDownloadFile() and the implementation has been updated to rely on the platform-level APIs instead of the browser-based behaviour. It now returns a promise.
  • For exports in general, there'll be a suggested name having the name computed from the URL (based on contents) as a fallback. The platform-level definition under hoppscotch-selfhost-web saveFileWithDialog(), is updated to prioritise the name if supplied.
  • The exportAsJSON helper function compiling the export business logic for environments is refactored to leverage the above helper function.
  • Minor code refactors aimed at eliminating redundancy to consume existing computed properties, etc and related cleanup.

Notes to reviewers

Please verify all the export flows (individual/bulk at the workspace level) for both the web and Desktop apps.


🔄 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/4336 **Author:** [@jamesgeorge007](https://github.com/jamesgeorge007) **Created:** 9/9/2024 **Status:** ✅ Merged **Merged:** 9/10/2024 **Merged by:** [@AndrewBastin](https://github.com/AndrewBastin) **Base:** `patch` ← **Head:** `fix/platform-based-file-export` --- ### 📝 Commits (1) - [`7f7c05d`](https://github.com/hoppscotch/hoppscotch/commit/7f7c05d14c154d70956825eeeefcdab65b3728d8) fix: ensure cross-platform compatibility with file exports ### 📊 Changes **8 files changed** (+116 additions, -109 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-common/src/components/collections/ImportExport.vue` (+20 -13) 📝 `packages/hoppscotch-common/src/components/collections/graphql/ImportExport.vue` (+4 -4) 📝 `packages/hoppscotch-common/src/components/environments/ImportExport.vue` (+24 -26) 📝 `packages/hoppscotch-common/src/components/environments/my/Environment.vue` (+8 -4) 📝 `packages/hoppscotch-common/src/components/environments/teams/Environment.vue` (+7 -4) 📝 `packages/hoppscotch-common/src/helpers/import-export/export/environment.ts` (+19 -30) 📝 `packages/hoppscotch-common/src/helpers/import-export/export/index.ts` (+23 -19) 📝 `packages/hoppscotch-common/src/platform/std/io.ts` (+11 -9) </details> ### 📄 Description This PR enforces the usage of platform-based API for file exports ensuring compatibility across web and Desktop apps. This accounts for export flows related to collections (REST/GQL) & environments. Closes #4332 HFE-578. ### What's changed - The `initializeDownloadCollection()` helper function is renamed to `initializeDownloadFile()` and the implementation has been updated to rely on the platform-level APIs instead of the browser-based behaviour. It now returns a promise. - For exports in general, there'll be a suggested name having the name computed from the URL (based on contents) as a fallback. The platform-level definition under `hoppscotch-selfhost-web` `saveFileWithDialog()`, is updated to prioritise the name if supplied. - The `exportAsJSON` helper function compiling the export business logic for environments is refactored to leverage the above helper function. - Minor code refactors aimed at eliminating redundancy to consume existing computed properties, etc and related cleanup. ### Notes to reviewers Please verify all the export flows (individual/bulk at the workspace level) for both the web and Desktop apps. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 02:15:56 +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#4756
No description provided.