Skip to content

fix(desktop): stop GlyphSpinner React churn - #73033

Closed
franco314 wants to merge 2 commits into
NousResearch:mainfrom
franco314:codex/fix-desktop-glyph-spinner-churn
Closed

fix(desktop): stop GlyphSpinner React churn#73033
franco314 wants to merge 2 commits into
NousResearch:mainfrom
franco314:codex/fix-desktop-glyph-spinner-churn

Conversation

@franco314

Copy link
Copy Markdown

Summary

  • render Desktop GlyphSpinner as a stable one-cell status glyph instead of advancing it through React state
  • preserve the existing component API, spinner-specific visual identity, status role, and accessible label
  • add a regression test proving the component schedules no timer work

Root cause

GlyphSpinner advanced its frame with setInterval plus setState. The default 80 ms interval caused roughly 12.6 React commits per second in a busy-but-silent session, including while the Desktop renderer was backgrounded because Chromium timer throttling is disabled. A decorative indicator therefore kept invalidating React even when no application data changed.

The TUI remains animated; this change is scoped to the Desktop component and the React churn reported here.

Closes #72844

Verification

  • npm --workspace apps/desktop run test:ui -- src/components/ui/glyph-spinner.test.tsx — pass; mutation-verified against main (timer count was 1)
  • npm --workspace apps/desktop run typecheck — pass
  • npm --workspace apps/desktop run lint — 0 errors (56 pre-existing warnings)
  • Prettier check on both changed files — pass
  • npm --workspace apps/desktop run build — pass
  • git diff --check — pass
  • Full Desktop UI suite: 304/308 files and 2,659/2,665 tests passed. The five failures are existing locale-sensitive assertions under the Windows es-AR locale and reproduce unchanged on the baseline checkout.

Duplicate check

Ran the repository duplicate preflight before implementation and again immediately before publication. The full paginated inventory covered 17,681 open PRs; there are no issue-number, title/symptom, timeline, or linked-PR matches. The sole open PR mentioning GlyphSpinner is #47537, which fixes model-profile refresh races and touches different files.

@alt-glitch alt-glitch added type/perf Performance improvement or optimization comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have labels Jul 28, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused performance fix. Current main still has the confirmed React-churn path: GlyphSpinner schedules setInterval/setFrame at apps/desktop/src/components/ui/glyph-spinner.tsx:57. This patch removes that path while preserving the existing props, status role, and accessible label; its added fake-timer test directly asserts that the component schedules no timer work.

The current-main component blob is the PR diff preimage (52e82412c881), so this is mechanically straightforward to salvage. The linked #74357 is a different, animation-preserving design; selecting between the two is a product decision rather than a correctness defect in this patch.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 30, 2026
@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Thanks @franco314 — you correctly identified the GlyphSpinner setState-per-frame churn, and the fix here is clean. We're going with #74357, which eliminates the same React commits via direct textContent mutation while keeping the spinner animated, and adds pause-on-hidden/blur behavior with broader test coverage. Closing this one to consolidate, but the diagnosis here was spot on — much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/perf Performance improvement or optimization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: GlyphSpinner causes ~12.6 React commits/s in busy-but-silent Desktop sessions

4 participants