Fix chart: add SSR mounting check

This commit is contained in:
root
2026-02-22 22:17:50 +00:00
parent 4246d38fc0
commit 3fb639261c
@@ -91,6 +91,12 @@ export default function TradingChart() {
ema20: false, ema50: false, ema200: false, bb: false, rsi: false, macd: false, thoth: true, volume: true, srZones: true, news: false, patterns: false, fib: false, countdown: false, calendar: false, correlation: false, funding: false
})
const [chartReady, setChartReady] = useState(false)
const [mounted, setMounted] = useState(false)
// Prevent SSR issues
useEffect(() => {
setMounted(true)
}, [])
// Initialize chart - run only on client
useEffect(() => {
@@ -308,6 +314,15 @@ export default function TradingChart() {
const getTE = (t: string) => t === 'uptrend' ? '🟢' : t === 'downtrend' ? '🔴' : '⚪️'
const getBC = (b: string) => b === 'bullish' ? 'text-green-400' : b === 'bearish' ? 'text-red-400' : 'text-yellow-400'
// Show loading until mounted (SSR safe)
if (!mounted) {
return (
<div className="flex items-center justify-center h-96">
<div className="text-white/50">Loading trading chart...</div>
</div>
)
}
return (
<div className="space-y-4">
{/* Asset Selection */}