[PR #5626] [MERGED] fix: remove ref_id field before collection exports and address race conditions #5290

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

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/5626
Author: @nivedin
Created: 11/28/2025
Status: Merged
Merged: 12/3/2025
Merged by: @jamesgeorge007

Base: patchHead: fix/export-doc-coll-bug


📝 Commits (10+)

  • ededb77 chore: remove _ref_id when exporting collections
  • 473ec19 fix: race condition when fetching user docs bug
  • 3b9dce4 chore: update helper comment
  • f35404e fix: race condition bug while fetching published docs
  • f338add chore: fix test
  • 1a755fd chore: remove console log
  • ebb7e68 chore: remove id while importing collection
  • d500c6c fix: add description in platform import
  • a79525d chore: cleanup
  • a58a078 chore: cleanup

📊 Changes

12 files changed (+167 additions, -35 deletions)

View changed files

📝 packages/hoppscotch-common/src/components/collections/ImportExport.vue (+17 -2)
📝 packages/hoppscotch-common/src/components/collections/index.vue (+7 -2)
📝 packages/hoppscotch-common/src/helpers/backend/helpers.ts (+2 -1)
📝 packages/hoppscotch-common/src/helpers/backend/queries/PublishedDocs.ts (+1 -1)
📝 packages/hoppscotch-common/src/helpers/collection/collection.ts (+14 -10)
📝 packages/hoppscotch-common/src/helpers/import-export/export/gqlCollections.ts (+2 -1)
📝 packages/hoppscotch-common/src/helpers/import-export/export/index.ts (+7 -0)
📝 packages/hoppscotch-common/src/helpers/import-export/export/myCollections.ts (+2 -1)
📝 packages/hoppscotch-common/src/helpers/import-export/import/index.ts (+27 -0)
📝 packages/hoppscotch-common/src/services/__tests__/workspace.service.spec.ts (+52 -1)
📝 packages/hoppscotch-common/src/services/workspace.service.ts (+33 -15)
📝 packages/hoppscotch-selfhost-web/src/platform/collections/web/import.ts (+3 -1)

📄 Description

Closes FE-1074 FE-1075

This PR fixes two issues:

  • This issue occurs only in the cloud instance, where the initial page load causes the UserPublishedDocsList call to fail because the authorization is passed as null.

  • While exporting a collection, the _ref_id, which should be unique, was not being stripped. It is now removed before exporting.

  • While importing a collection the id is removed and a new _ref_id is added.

What's changed

Notes to reviewers


Summary by cubic

Removes _ref_id from exported collections and fixes a race condition that caused UserPublishedDocsList to fail on first load when auth was null. Addresses FE-1074 and FE-1075.

  • Bug Fixes
    • Import/Export: strip _ref_id in personal and team exports; sanitize personal imports by dropping legacy id/_ref_id and converting to the new format.
    • Workspace: watch currentUser along with workspace, wait for login to confirm, and only fetch user/team published docs when authenticated.
    • Tests: add coverage for authenticated vs unauthenticated fetch behavior and workspace transitions.

Written for commit cad9e6620d. Summary will update automatically on new commits.


🔄 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/5626 **Author:** [@nivedin](https://github.com/nivedin) **Created:** 11/28/2025 **Status:** ✅ Merged **Merged:** 12/3/2025 **Merged by:** [@jamesgeorge007](https://github.com/jamesgeorge007) **Base:** `patch` ← **Head:** `fix/export-doc-coll-bug` --- ### 📝 Commits (10+) - [`ededb77`](https://github.com/hoppscotch/hoppscotch/commit/ededb777be4946c2db9798b659091ead4b1a3d52) chore: remove _ref_id when exporting collections - [`473ec19`](https://github.com/hoppscotch/hoppscotch/commit/473ec191ec83d28289ba1fd8cb28b645a0329953) fix: race condition when fetching user docs bug - [`3b9dce4`](https://github.com/hoppscotch/hoppscotch/commit/3b9dce460691f87167ed514d24198d0e98968806) chore: update helper comment - [`f35404e`](https://github.com/hoppscotch/hoppscotch/commit/f35404e171ebdad14d9b213ad1405cc749ec4157) fix: race condition bug while fetching published docs - [`f338add`](https://github.com/hoppscotch/hoppscotch/commit/f338add6eb581f18caab14ebba3feb92e3bc8fb6) chore: fix test - [`1a755fd`](https://github.com/hoppscotch/hoppscotch/commit/1a755fd622202e1af615332d373dffb48d700492) chore: remove console log - [`ebb7e68`](https://github.com/hoppscotch/hoppscotch/commit/ebb7e68dece515c8761c915ad4806d7ee5d1f67c) chore: remove id while importing collection - [`d500c6c`](https://github.com/hoppscotch/hoppscotch/commit/d500c6cf59ef9c7c158d8379784c3bbd53ab0599) fix: add description in platform import - [`a79525d`](https://github.com/hoppscotch/hoppscotch/commit/a79525d1268149eabc8d6b3cd8cc48e127da72b5) chore: cleanup - [`a58a078`](https://github.com/hoppscotch/hoppscotch/commit/a58a078c2371671d4aeaad6c10b6e36991d0ff20) chore: cleanup ### 📊 Changes **12 files changed** (+167 additions, -35 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-common/src/components/collections/ImportExport.vue` (+17 -2) 📝 `packages/hoppscotch-common/src/components/collections/index.vue` (+7 -2) 📝 `packages/hoppscotch-common/src/helpers/backend/helpers.ts` (+2 -1) 📝 `packages/hoppscotch-common/src/helpers/backend/queries/PublishedDocs.ts` (+1 -1) 📝 `packages/hoppscotch-common/src/helpers/collection/collection.ts` (+14 -10) 📝 `packages/hoppscotch-common/src/helpers/import-export/export/gqlCollections.ts` (+2 -1) 📝 `packages/hoppscotch-common/src/helpers/import-export/export/index.ts` (+7 -0) 📝 `packages/hoppscotch-common/src/helpers/import-export/export/myCollections.ts` (+2 -1) 📝 `packages/hoppscotch-common/src/helpers/import-export/import/index.ts` (+27 -0) 📝 `packages/hoppscotch-common/src/services/__tests__/workspace.service.spec.ts` (+52 -1) 📝 `packages/hoppscotch-common/src/services/workspace.service.ts` (+33 -15) 📝 `packages/hoppscotch-selfhost-web/src/platform/collections/web/import.ts` (+3 -1) </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 FE-1074 FE-1075 This PR fixes two issues: - This issue occurs only in the cloud instance, where the initial page load causes the UserPublishedDocsList call to fail because the authorization is passed as null. - While exporting a collection, the _ref_id, which should be unique, was not being stripped. It is now removed before exporting. - While importing a collection the id is removed and a new _ref_id is added. <!-- Add an introduction into what this PR tries to solve in a couple of sentences --> ### What's changed <!-- Describe point by point the different things you have changed in this PR --> <!-- 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 --> ### Notes to reviewers <!-- Any information you feel the reviewer should know about when reviewing your PR --> <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Removes _ref_id from exported collections and fixes a race condition that caused UserPublishedDocsList to fail on first load when auth was null. Addresses FE-1074 and FE-1075. - **Bug Fixes** - Import/Export: strip `_ref_id` in personal and team exports; sanitize personal imports by dropping legacy `id`/`_ref_id` and converting to the new format. - Workspace: watch `currentUser` along with workspace, wait for login to confirm, and only fetch user/team published docs when authenticated. - Tests: add coverage for authenticated vs unauthenticated fetch behavior and workspace transitions. <sup>Written for commit cad9e6620dd8fe7642517e3db6f06060683e7089. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 02:45:00 +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#5290
No description provided.