mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Fix/website logo theme persistence (#6040)
* feat: add Issue Fixer Orchestrator mode * fix: persist logo theme state on page navigation and refresh - Add mounted state to prevent hydration mismatch - Use theme as fallback when resolvedTheme is not available - Ensure logo matches the persisted theme on initial page load Fixes issue where logo would revert to dark version after page refresh even when light theme was selected
This commit is contained in:
parent
bcad858b2f
commit
c47de36b05
1 changed files with 18 additions and 2 deletions
|
|
@ -1,8 +1,24 @@
|
|||
"use client"
|
||||
|
||||
import { useTheme } from "next-themes"
|
||||
import { useEffect, useState } from "react"
|
||||
|
||||
export function useLogoSrc(): string {
|
||||
const { resolvedTheme } = useTheme()
|
||||
return resolvedTheme === "light" ? "/Roo-Code-Logo-Horiz-blk.svg" : "/Roo-Code-Logo-Horiz-white.svg"
|
||||
const { resolvedTheme, theme } = useTheme()
|
||||
const [mounted, setMounted] = useState(false)
|
||||
|
||||
// Avoid hydration mismatch by waiting for client-side mount
|
||||
useEffect(() => {
|
||||
setMounted(true)
|
||||
}, [])
|
||||
|
||||
// Before mounting, return a default logo (dark theme as specified in providers)
|
||||
// This prevents the logo from flickering on initial load
|
||||
if (!mounted) {
|
||||
return "/Roo-Code-Logo-Horiz-white.svg"
|
||||
}
|
||||
|
||||
// Use theme as fallback if resolvedTheme is not available yet
|
||||
const currentTheme = resolvedTheme || theme
|
||||
return currentTheme === "light" ? "/Roo-Code-Logo-Horiz-blk.svg" : "/Roo-Code-Logo-Horiz-white.svg"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue