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()
|
loadData()
|
||||||
}, [siteId, funnelId, dateRange])
|
}, [siteId, funnelId, dateRange])
|
||||||
|
|
||||||
|
const { resolvedTheme } = useTheme()
|
||||||
|
const chartColors = useMemo(
|
||||||
|
() => (resolvedTheme === 'dark' ? CHART_COLORS_DARK : CHART_COLORS_LIGHT),
|
||||||
|
[resolvedTheme]
|
||||||
|
)
|
||||||
|
|
||||||
const loadData = async () => {
|
const loadData = async () => {
|
||||||
try {
|
try {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
@@ -98,12 +104,6 @@ export default function FunnelReportPage() {
|
|||||||
conversion: s.conversion
|
conversion: s.conversion
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const { resolvedTheme } = useTheme()
|
|
||||||
const chartColors = useMemo(
|
|
||||||
() => (resolvedTheme === 'dark' ? CHART_COLORS_DARK : CHART_COLORS_LIGHT),
|
|
||||||
[resolvedTheme]
|
|
||||||
)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full max-w-6xl mx-auto px-4 sm:px-6 py-8">
|
<div className="w-full max-w-6xl mx-auto px-4 sm:px-6 py-8">
|
||||||
<div className="mb-8">
|
<div className="mb-8">
|
||||||
|
|||||||
Reference in New Issue
Block a user