orca icon indicating copy to clipboard operation
orca copied to clipboard

[Bug]:

Open shanren opened this issue 4 months ago • 1 comments

Operating system

Windows

Orca version

v1.4.138

Details

Environment

  • OS: Windows 11 24H2 (also reproducible on another Windows machine)
  • Orca version: v1.4.138, v1.4.139
  • Last known good version: v1.4.137

Description

Since upgrading from v1.4.137 to v1.4.138, switching between application views causes a noticeable UI freeze.

The freeze is short (roughly 100–300ms), but it is very noticeable and happens almost every time.

This issue continues to exist in v1.4.139.

Steps to reproduce

  1. Launch Orca.
  2. Open Settings.
  3. Switch between different Settings pages (General, Appearance, etc.), or switch between other top-level views.
  4. Observe a brief freeze before the new page is rendered.

Expected behavior

Image

View transitions should be smooth, as they were in v1.4.137.

Actual behavior

The entire window appears to pause briefly before the target view is displayed.

This is not limited to Settings—it also occurs in other common UI pages.

Additional observations

  • The freeze affects the whole window rather than only the page content.
  • It appears to happen regardless of project size.
  • It is reproducible even when no heavy background tasks are running.
  • Downgrading to v1.4.137 makes the issue disappear.

Possible cause (speculation)

I'm not sure what changed in v1.4.138, but since the issue started exactly after upgrading from v1.4.137, it might be related to one of the following:

  • Renderer lifecycle or view restoration changes.
  • A synchronous operation executed during view switching.
  • Global state updates causing unnecessary re-rendering of the application shell.
  • A Windows-specific rendering or IPC regression.

I haven't profiled it yet, but the behavior feels like the renderer's main thread is briefly blocked during navigation.

If there's anything I can test or any logs/profiling information that would help, I'd be happy to provide them.

shanren avatar Jul 16 '26 09:07 shanren

Bisected 1.4.137 → 1.4.138 via git history (no dependency/Electron/CSS change in the range, so it's a code regression). Strongest suspect:

8b8e1bba — "fix: restore the active top-level view across renderer reload (#8265)"

That commit makes activeView a persisted field by adding it to the debounced UI writer (src/renderer/src/App.tsx payload + deps array). Effect: every top-level view switch now schedules a full durable-state save, where before a pure view switch touched no persisted field and saved nothing.

The save's CPU-bound part runs synchronously on the Electron main thread before the first await (src/main/persistence.ts writeToDiskAsync → computeStateHash() + buildStateToSave()): two full-state JSON.stringify passes + sha1 over the multi-MB durable state. A blocked main thread freezes the whole window (chrome + renderers), and the cost scales with accumulated Orca state (worktrees/tabs/automation runs), not git repo size — matching the report.

Micro-benchmark of that exact path (Node 24, win32, this box):

durable state new blocking work per view switch
~1.6 MB ~18 ms
~4 MB ~42 ms
~8 MB ~88 ms

(previously ~0 ms per switch). Reaches the reported 100–300 ms band for heavy accumulated state.

node docs/bug-reproductions/scripts/9002-view-switch-save-serialize.mjs

Corroboration that this path is a known hot spot: the later fix 2783f758 (#9290, "compact JSON for durable-state save payload") targets this exact JSON.stringify line — but it landed after 1.4.139 and only trims ~15%, which is why the freeze persists in 1.4.139.

Caveats (honest scope): (1) at typical (~1.6 MB) state the benchmark shows ~18 ms, not 100–300 ms, so either affected users carry large state or an extra per-switch cost stacks on top (renderer re-hydration echo, tmp-write+rename, Defender) — a live main-process Performance trace would close the magnitude. (2) The "Settings General/Appearance sub-page" example doesn't change activeView (local component state), so that half is a separate first-mount cost, not this commit.

Suggested fix direction: persist activeView off the hashed hot-save path (e.g. on blur/visibilitychange/unload) rather than on every navigation.

Full write-up + benchmark in docs/bug-reproductions/9002-view-switch-freeze-regression.md.

🔁 Reproduced via automated Windows bug-reproduction pass (regressing commit + benchmark; magnitude caveats noted).

OrcaWin avatar Jul 18 '26 08:07 OrcaWin