Skip to content

fix(theme): prevent freeze when switching to system theme - #2790

Merged
bajrangCoder merged 1 commit into
mainfrom
fix/system-theme-freeze
Aug 22, 2026
Merged

fix(theme): prevent freeze when switching to system theme#2790
bajrangCoder merged 1 commit into
mainfrom
fix/system-theme-freeze

Conversation

@bajrangCoder

Copy link
Copy Markdown
Member

No description provided.

@greptile-apps

greptile-apps Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR prevents synchronous recursion when switching to the system theme while retaining immediate refreshes and subsequent operating-system theme synchronization.

  • Refreshes the mutable system preset before applying it.
  • Adds an applyTheme flag so watcher initialization can update the preset without recursively applying it.
  • Preserves full theme application for later device dark-mode changes.

Confidence Score: 5/5

The PR appears safe to merge, with the recursion removed while system-theme rendering and operating-system change tracking remain intact.

The outer system-theme application renders the refreshed shared preset, watcher initialization no longer re-enters application, and later media-query changes still perform a full update.

Important Files Changed

Filename Overview
src/theme/list.js Refreshes the system preset before rendering and suppresses recursive application during watcher initialization without disrupting later media-query events.
src/theme/preInstalled.js Adds an applyTheme control that separates system-preset mutation from optional immediate application and editor-theme persistence.

Sequence Diagram

sequenceDiagram
    participant User
    participant Apply as apply("system")
    participant System as updateSystemTheme
    participant Settings
    participant Watcher as updateSystemThemeWatcher
    User->>Apply: Select system theme
    Apply->>System: "Refresh preset (applyTheme=false)"
    System-->>Apply: Updated colors and editor preference
    Apply->>Apply: Render refreshed preset
    Apply->>Settings: "Persist appTheme="system""
    Settings->>Watcher: update:appTheme
    Watcher->>System: "Sync OS state (applyTheme=false)"
    Note over Watcher,System: No recursive apply
Loading

Reviews (1): Last reviewed commit: "fix(theme): prevent freeze when switchin..." | Re-trigger Greptile

@bajrangCoder
bajrangCoder added this pull request to the merge queue Aug 22, 2026
Merged via the queue into main with commit d1a6249 Aug 22, 2026
9 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in The Code Board - Acode Aug 22, 2026
@bajrangCoder
bajrangCoder deleted the fix/system-theme-freeze branch August 22, 2026 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant