Skip to content

perf(settings): avoid theme DOM updates and remote sync for unrelated settings #784

Description

@Juliusolsson05

Evidence

The React-wide audit found that features/settings/hooks/useThemeSync.ts selects the entire settings object and calls applyTheme plus remoteSetThemeSettings on every settings identity change. settings/slice.ts also calls applyTheme synchronously in setSettings and several non-theme toggles. Updating unrelated preferences therefore repeats CSS/theme work and sends the full settings object over IPC; dispatch color flag changes also trigger the root theme effect.

Expected

Select the effective theme inputs only, including the selected custom theme and relevant font settings. Apply/mirror only when that effective projection changes. Preserve pre-hydration theme initialization, immediate visible theme changes, remote-client synchronization, and custom-theme edits without stale snapshots.

Verification needed

Unrelated preference/flag changes must not apply theme or send theme IPC; actual theme/font/custom-theme edits must still do both. Measure impact rather than claiming a frame-rate gain from source inspection alone.

Refs #103, #763. Discovered while implementing #781/#782; intentionally separate from the runtime-update fixes.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    sev:P3Minortype:perfPerformance or resource use

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions