mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
* 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
24 lines
755 B
TypeScript
24 lines
755 B
TypeScript
"use client"
|
|
|
|
import { useTheme } from "next-themes"
|
|
import { useEffect, useState } from "react"
|
|
|
|
export function useLogoSrc(): string {
|
|
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"
|
|
}
|