[PR #5747] [MERGED] perf(desktop): cache store path resolution #5333

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

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/5747
Author: @CuriousCorrelation
Created: 1/5/2026
Status: Merged
Merged: 1/6/2026
Merged by: @jamesgeorge007

Base: patchHead: feat-desktop-cloud-cached-ipc-call


📝 Commits (2)

  • e9b55f7 perf(desktop): cache store path resolution
  • 899feea fix(desktop): revert bump to fix screen freeze

📊 Changes

8 files changed (+2181 additions, -1866 deletions)

View changed files

📝 packages/hoppscotch-common/src/components.d.ts (+0 -3)
📝 packages/hoppscotch-common/src/kernel/store.ts (+8 -3)
📝 packages/hoppscotch-desktop/package.json (+19 -18)
📝 packages/hoppscotch-desktop/src-tauri/Cargo.lock (+1294 -1217)
📝 packages/hoppscotch-desktop/src-tauri/Cargo.toml (+18 -18)
📝 packages/hoppscotch-desktop/src/components.d.ts (+1 -4)
📝 packages/hoppscotch-selfhost-web/src/kernel/store.ts (+10 -5)
📝 pnpm-lock.yaml (+831 -598)

📄 Description

A performance improvement that also fixes the white screen crash on
macOS desktop app that occurs every ~2 minutes when logged in.

Closes FE-1110
Closes #5716
Closes #5722
Closes #5730
Closes #5739

The issue was introduced in v25.11.0 when store path resolution changed
from using a constant to dynamically computing the path on every
operation. Each Store.set(), Store.get(), etc. now calls
getStorePath() which does:

The await getStoreDir() - IPC call to Rust
The await join(storeDir, STORE_PATH) - another IPC call

When you make a request, multiple stores update (history, tabs, etc.)
and each update triggers these 2 extra IPC calls. The cascade overwhelms
the main thread, Firestore SDK thinks the page is unloading and sends a
beacon, then the webview fails to recover and goes white.

On v25.10.1 this worked because store operations used a constant path
with no IPC overhead per operation.

What's changed

Added a cached store path that's computed once on first access:

let cachedStorePath: string | undefined

const getStorePath = async (): Promise<string> => {
  if (cachedStorePath) return cachedStorePath

  // ... resolution stuff ...

  cachedStorePath = resolvedPath
  return cachedStorePath
}

Testing

On macOS with desktop app v25.12.0:

  • Log in to Hoppscotch Cloud
  • Make a couple of requests
  • Do nothing and wait for a few minutes
  • Previously white screen crash within ~2 minutes, now: app should remains stable

Summary by cubic

Cache the store path so it’s resolved once instead of on every store operation. This removes extra IPC calls, fixes the macOS desktop white‑screen crash, and improves performance. Addresses Linear FE-1110.

  • Bug Fixes

    • Cache the resolved store path (cachedStorePath) in common and selfhost-web kernels.
    • Replace per-operation getStoreDir + join IPC calls with the cached path; fall back to a constant path on errors.
    • Prevent main-thread overload and Firestore unload beacons that led to periodic white screens when logged in.
  • Dependencies

    • Revert desktop Tauri and related plugins to pre‑v25.11.0 versions (Cargo.toml and package.json) to restore WebView recovery. Addresses Linear FE-1111.

Written for commit 899feea37d. Summary will update 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/5747 **Author:** [@CuriousCorrelation](https://github.com/CuriousCorrelation) **Created:** 1/5/2026 **Status:** ✅ Merged **Merged:** 1/6/2026 **Merged by:** [@jamesgeorge007](https://github.com/jamesgeorge007) **Base:** `patch` ← **Head:** `feat-desktop-cloud-cached-ipc-call` --- ### 📝 Commits (2) - [`e9b55f7`](https://github.com/hoppscotch/hoppscotch/commit/e9b55f7d8caeeb045e4b767689bcf2436bae48f5) perf(desktop): cache store path resolution - [`899feea`](https://github.com/hoppscotch/hoppscotch/commit/899feea37d0fbbfa1cb6ef5422ad2bcae25b4a0b) fix(desktop): revert bump to fix screen freeze ### 📊 Changes **8 files changed** (+2181 additions, -1866 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-common/src/components.d.ts` (+0 -3) 📝 `packages/hoppscotch-common/src/kernel/store.ts` (+8 -3) 📝 `packages/hoppscotch-desktop/package.json` (+19 -18) 📝 `packages/hoppscotch-desktop/src-tauri/Cargo.lock` (+1294 -1217) 📝 `packages/hoppscotch-desktop/src-tauri/Cargo.toml` (+18 -18) 📝 `packages/hoppscotch-desktop/src/components.d.ts` (+1 -4) 📝 `packages/hoppscotch-selfhost-web/src/kernel/store.ts` (+10 -5) 📝 `pnpm-lock.yaml` (+831 -598) </details> ### 📄 Description A performance improvement that also fixes the white screen crash on macOS desktop app that occurs every ~2 minutes when logged in. Closes FE-1110 Closes #5716 Closes #5722 Closes #5730 Closes #5739 The issue was introduced in v25.11.0 when store path resolution changed from using a constant to dynamically computing the path on every operation. Each `Store.set()`, `Store.get()`, etc. now calls `getStorePath()` which does: The `await getStoreDir()` - IPC call to Rust The `await join(storeDir, STORE_PATH)` - another IPC call When you make a request, multiple stores update (history, tabs, etc.) and each update triggers these 2 extra IPC calls. The cascade overwhelms the main thread, Firestore SDK thinks the page is unloading and sends a beacon, then the webview fails to recover and goes white. On v25.10.1 this worked because store operations used a constant path with no IPC overhead per operation. ### What's changed Added a cached store path that's computed once on first access: ```typescript let cachedStorePath: string | undefined const getStorePath = async (): Promise<string> => { if (cachedStorePath) return cachedStorePath // ... resolution stuff ... cachedStorePath = resolvedPath return cachedStorePath } ``` ### Testing On macOS with desktop app v25.12.0: - Log in to Hoppscotch Cloud - Make a couple of requests - Do nothing and wait for a few minutes - Previously white screen crash within ~2 minutes, now: app should remains stable <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Cache the store path so it’s resolved once instead of on every store operation. This removes extra IPC calls, fixes the macOS desktop white‑screen crash, and improves performance. Addresses Linear FE-1110. - **Bug Fixes** - Cache the resolved store path (cachedStorePath) in common and selfhost-web kernels. - Replace per-operation getStoreDir + join IPC calls with the cached path; fall back to a constant path on errors. - Prevent main-thread overload and Firestore unload beacons that led to periodic white screens when logged in. - **Dependencies** - Revert desktop Tauri and related plugins to pre‑v25.11.0 versions (Cargo.toml and package.json) to restore WebView recovery. Addresses Linear FE-1111. <sup>Written for commit 899feea37d0fbbfa1cb6ef5422ad2bcae25b4a0b. Summary will update 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:47:27 +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#5333
No description provided.