Skip to content

fix: system theme#2524

Open
RohitKushvaha01 wants to merge 2 commits into
Acode-Foundation:mainfrom
RohitKushvaha01:fix/system-theme-editor-update
Open

fix: system theme#2524
RohitKushvaha01 wants to merge 2 commits into
Acode-Foundation:mainfrom
RohitKushvaha01:fix/system-theme-editor-update

Conversation

@RohitKushvaha01

Copy link
Copy Markdown
Member

Closes #2521

@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR switches system-theme synchronization to browser color-scheme events. The main changes are:

  • Replaces periodic theme polling with a MediaQueryList change listener.
  • Applies the preferred editor theme when the OS color scheme changes.

Confidence Score: 5/5

The changed flow looks mergeable after two small compatibility and notification fixes.

  • Older MediaQueryList implementations can fail when the watcher starts.
  • Automatic OS theme changes can display a misleading settings-saved toast.
  • Listener registration and removal otherwise use the same stable callback.

src/palettes/changeTheme/index.js and src/theme/preInstalled.js

Important Files Changed

Filename Overview
src/palettes/changeTheme/index.js Replaces polling with a MediaQueryList listener, but lacks the legacy listener fallback.
src/theme/preInstalled.js Synchronizes the editor theme with the OS theme, but enables save notifications for automatic updates.

Reviews (1): Last reviewed commit: "fix: system theme" | Re-trigger Greptile

function startSystemThemeWatcher() {
if (intervalId) return;
intervalId = setInterval(syncSystemTheme, updateTimeMs);
darkModeMediaQuery.addEventListener("change", syncSystemTheme);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Legacy Media Query Listener Crash

When a WebView supports matchMedia but exposes only addListener, selecting the system theme now throws because addEventListener is undefined. The previous polling path worked in this runtime, so system-theme synchronization needs matching addListener and removeListener fallbacks.

Comment thread src/theme/preInstalled.js Outdated
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

System theme doesnt work

1 participant