[PR #5132] [MERGED] fix(desktop): align connected instance with launch #5069

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

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/5132
Author: @CuriousCorrelation
Created: 6/6/2025
Status: Merged
Merged: 6/10/2025
Merged by: @jamesgeorge007

Base: patchHead: fix-desktop-overwrite-instance-connection


📝 Commits (5)

  • f27d2ae fix(desktop): align connected instance with launch
  • 9e1e568 feat(desktop): abstract away instance to platform
  • fd8140a fix(desktop): consolidate instance verb
  • 5a2ebdb fix(desktop): vendored instance display name
  • e885d39 fix(desktop): instance switcher target string

📊 Changes

8 files changed (+126 additions, -34 deletions)

View changed files

📝 packages/hoppscotch-common/src/components.d.ts (+0 -2)
📝 packages/hoppscotch-common/src/components/app/Header.vue (+17 -5)
📝 packages/hoppscotch-common/src/components/instance/Switcher.vue (+22 -3)
📝 packages/hoppscotch-common/src/platform/index.ts (+2 -0)
packages/hoppscotch-common/src/platform/instance.ts (+10 -0)
📝 packages/hoppscotch-common/src/services/instance-switcher.service.ts (+35 -20)
📝 packages/hoppscotch-desktop/src/views/Home.vue (+30 -4)
📝 packages/hoppscotch-selfhost-web/src/main.ts (+10 -0)

📄 Description

The current implementation uses two separate stores for the desktop app: one for the InstanceSwitcherService and another for the main desktop app.

This creates a de-sync between the vendored app launched by the core service, vs the app expected by the InstanceSwitcherService.

This adds a overwrite for InstanceSwitcherService store to sync "connected" status correctly.

Closes HFE-894

During the development of the new kernel desktop arch (see HFE-672), separate stores were introduced as a transitional necessity to handle initialization order dependencies.

Basically a couple of things including why native interceptor needed to be ready before PersistenceService and managing storage contexts during web app bundle transitions, plus eliminating some of the circular service dependencies that was handled eventually with the InitializationService.

This is now being phased out in favor of better platform and system agnostic path resolution (see HFE-829 and sub ticket HFE-864) with the goal of eventually introducing a kernel store for hoppscotch-desktop, see HFE-877 for part 6 of the process.

Notes to reviewers

Make sure ~/Library/Application Support/io.hoppscotch.desktop/hopp.store.json's "connectionState" key always has the "vendored" instances upon launch, subsequent changes are expected.

For example:

After connecting to a self-hosted instance
{
  "connectionState": {
    "status": "connected",
    "instance": {
      "type": "server",
      "serverUrl": "https://api.company.com/desktop-app-server",
      "displayName": "company.com",
      "version": "2025.5.1",
      "lastUsed": "2025-06-06T10:22:45.721Z",
      "bundleName": "hoppscotch_bundle_api_company_com_1717668165"
    }
  },
  "recentInstances": [
    {
      "type": "server",
      "serverUrl": "https://api.company.com/desktop-app-server",
      "displayName": "company.com",
      "version": "2025.5.1,
      "lastUsed": "2025-06-06T10:22:45.721Z",
      "bundleName": "hoppscotch_bundle_api_company_com"
    },
    {
      "type": "server",
      "serverUrl": "https://staging.example.com/desktop-app-server",
      "displayName": "example.com",
      "version": "2025.5.1",
      "lastUsed": "2025-06-02T13:28:17.456Z",
      "bundleName": "hoppscotch_bundle_staging_example_com"
    }
  ]
}
Upon subsequent launch
{
  "connectionState": {
    "status": "connected",
    "instance": {
      "type": "vendored",
      "displayName": "Hoppscotch",
      "version": "25.5.1"
    }
  },
  "recentInstances": [
    {
      "type": "server",
      "serverUrl": "https://api.company.com/desktop-app-server",
      "displayName": "company.com",
      "version": "2025.5.1",
      "lastUsed": "2025-06-05T14:30:22.543Z",
      "bundleName": "hoppscotch_bundle_api_company_com"
    },
    {
      "type": "server",
      "serverUrl": "http://localhost:3200/desktop-app-server",
      "displayName": "localhost",
      "version": "2025.5.1",
      "lastUsed": "2025-06-04T09:15:33.120Z",
      "bundleName": "hoppscotch_bundle_localhost_3200"
    }
  ]
}                                                                                              

🔄 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/5132 **Author:** [@CuriousCorrelation](https://github.com/CuriousCorrelation) **Created:** 6/6/2025 **Status:** ✅ Merged **Merged:** 6/10/2025 **Merged by:** [@jamesgeorge007](https://github.com/jamesgeorge007) **Base:** `patch` ← **Head:** `fix-desktop-overwrite-instance-connection` --- ### 📝 Commits (5) - [`f27d2ae`](https://github.com/hoppscotch/hoppscotch/commit/f27d2aeb3038e30a9cf7503f2ac020a2281dbb78) fix(desktop): align connected instance with launch - [`9e1e568`](https://github.com/hoppscotch/hoppscotch/commit/9e1e56845419ca7f892cdb740c47885a885250ae) feat(desktop): abstract away instance to platform - [`fd8140a`](https://github.com/hoppscotch/hoppscotch/commit/fd8140aa050b153b502115c3c886ac25faf54945) fix(desktop): consolidate instance verb - [`5a2ebdb`](https://github.com/hoppscotch/hoppscotch/commit/5a2ebdb514a9ef43c38675876352ca067a6410b5) fix(desktop): vendored instance display name - [`e885d39`](https://github.com/hoppscotch/hoppscotch/commit/e885d39da4676e686ee7d3859b33918912b958df) fix(desktop): instance switcher target string ### 📊 Changes **8 files changed** (+126 additions, -34 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-common/src/components.d.ts` (+0 -2) 📝 `packages/hoppscotch-common/src/components/app/Header.vue` (+17 -5) 📝 `packages/hoppscotch-common/src/components/instance/Switcher.vue` (+22 -3) 📝 `packages/hoppscotch-common/src/platform/index.ts` (+2 -0) ➕ `packages/hoppscotch-common/src/platform/instance.ts` (+10 -0) 📝 `packages/hoppscotch-common/src/services/instance-switcher.service.ts` (+35 -20) 📝 `packages/hoppscotch-desktop/src/views/Home.vue` (+30 -4) 📝 `packages/hoppscotch-selfhost-web/src/main.ts` (+10 -0) </details> ### 📄 Description The current implementation uses two separate stores for the desktop app: one for the `InstanceSwitcherService` and another for the main desktop app. This creates a de-sync between the vendored app launched by the core service, vs the app expected by the `InstanceSwitcherService`. This adds a overwrite for `InstanceSwitcherService` store to sync `"connected"` status correctly. Closes HFE-894 During the development of the new kernel desktop arch (see HFE-672), separate stores were introduced as a transitional necessity to handle initialization order dependencies. Basically a couple of things including why native interceptor needed to be ready before `PersistenceService` and managing storage contexts during web app bundle transitions, plus eliminating some of the circular service dependencies that was handled eventually with the `InitializationService`. This is now being phased out in favor of better platform and system agnostic path resolution (see HFE-829 and sub ticket HFE-864) with the goal of eventually introducing a [kernel](https://github.com/hoppscotch/hoppscotch/tree/main/packages/hoppscotch-common/src/kernel) store for hoppscotch-desktop, see HFE-877 for part 6 of the process. ### Notes to reviewers Make sure `~/Library/Application Support/io.hoppscotch.desktop/hopp.store.json`'s `"connectionState"` key always has the "vendored" instances upon launch, subsequent changes are expected. For example: ##### After connecting to a self-hosted instance ``` { "connectionState": { "status": "connected", "instance": { "type": "server", "serverUrl": "https://api.company.com/desktop-app-server", "displayName": "company.com", "version": "2025.5.1", "lastUsed": "2025-06-06T10:22:45.721Z", "bundleName": "hoppscotch_bundle_api_company_com_1717668165" } }, "recentInstances": [ { "type": "server", "serverUrl": "https://api.company.com/desktop-app-server", "displayName": "company.com", "version": "2025.5.1, "lastUsed": "2025-06-06T10:22:45.721Z", "bundleName": "hoppscotch_bundle_api_company_com" }, { "type": "server", "serverUrl": "https://staging.example.com/desktop-app-server", "displayName": "example.com", "version": "2025.5.1", "lastUsed": "2025-06-02T13:28:17.456Z", "bundleName": "hoppscotch_bundle_staging_example_com" } ] } ``` ##### Upon subsequent launch ``` { "connectionState": { "status": "connected", "instance": { "type": "vendored", "displayName": "Hoppscotch", "version": "25.5.1" } }, "recentInstances": [ { "type": "server", "serverUrl": "https://api.company.com/desktop-app-server", "displayName": "company.com", "version": "2025.5.1", "lastUsed": "2025-06-05T14:30:22.543Z", "bundleName": "hoppscotch_bundle_api_company_com" }, { "type": "server", "serverUrl": "http://localhost:3200/desktop-app-server", "displayName": "localhost", "version": "2025.5.1", "lastUsed": "2025-06-04T09:15:33.120Z", "bundleName": "hoppscotch_bundle_localhost_3200" } ] } ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 02:33:01 +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#5069
No description provided.