fix: refactor FunnelReportPage to optimize theme handling by moving chart color logic into useMemo, improving performance and code clarity
This commit is contained in:
@@ -51,6 +51,12 @@ export default function FunnelReportPage() {
|
||||
loadData()
|
||||
}, [siteId, funnelId, dateRange])
|
||||
|
||||
const { resolvedTheme } = useTheme()
|
||||
const chartColors = useMemo(
|
||||
() => (resolvedTheme === 'dark' ? CHART_COLORS_DARK : CHART_COLORS_LIGHT),
|
||||
[resolvedTheme]
|
||||
)
|
||||
|
||||
const loadData = async () => {
|
||||
try {
|
||||
setLoading(true)
|
||||
@@ -98,12 +104,6 @@ export default function FunnelReportPage() {
|
||||
conversion: s.conversion
|
||||
}))
|
||||
|
||||
const { resolvedTheme } = useTheme()
|
||||
const chartColors = useMemo(
|
||||
() => (resolvedTheme === 'dark' ? CHART_COLORS_DARK : CHART_COLORS_LIGHT),
|
||||
[resolvedTheme]
|
||||
)
|
||||
|
||||
return (
|
||||
<div className="w-full max-w-6xl mx-auto px-4 sm:px-6 py-8">
|
||||
<div className="mb-8">
|
||||
|
||||
Reference in New Issue
Block a user