Skip to content

Conversation

@ibex088
Copy link

@ibex088 ibex088 commented Jan 15, 2026

Fixes #1517
Fixes CAP-602

Greptile Summary

Fixed theme toggle by adding document.body.className = newTheme in the setThemeHandler function. Previously, the theme state and cookie were updated but the DOM wasn't modified immediately, causing the UI to remain in the current theme until page reload.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix is a simple one-line addition that directly addresses the reported bug. The approach is consistent with existing patterns in the codebase (login/signup forms use the same pattern). The change correctly applies the theme to the DOM immediately when toggled, and the useEffect on mount already handles initial theme application from cookies.
  • No files require special attention

Important Files Changed

Filename Overview
apps/web/app/(org)/dashboard/Contexts.tsx Added missing document.body.className assignment to immediately apply theme changes when toggled

Sequence Diagram

sequenceDiagram
    participant User
    participant ThemeToggle as Theme Toggle UI
    participant setThemeHandler
    participant State as React State
    participant Cookie as Browser Cookie
    participant DOM as document.body

    User->>ThemeToggle: Click theme toggle
    ThemeToggle->>setThemeHandler: setThemeHandler(newTheme)
    setThemeHandler->>State: setTheme(newTheme)
    setThemeHandler->>DOM: document.body.className = newTheme
    Note over DOM: Theme applied immediately
    setThemeHandler->>Cookie: Cookies.set("theme", newTheme)
    State-->>ThemeToggle: Re-render with new theme
    ThemeToggle-->>User: UI updates with new theme
Loading

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 15, 2026

Greptile's behavior is changing!

From now on, if a review finishes with no comments, we will not post an additional "statistics" comment to confirm that our review found nothing to comment on. However, you can confirm that we reviewed your changes in the status check section.

This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR".

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot switch to Dark mode — app always stays in Light theme

1 participant