diff --git a/app/sites/[id]/behavior/page.tsx b/app/sites/[id]/behavior/page.tsx index 8c93ffa..a7e5794 100644 --- a/app/sites/[id]/behavior/page.tsx +++ b/app/sites/[id]/behavior/page.tsx @@ -53,6 +53,7 @@ export default function BehaviorPage() { const [deadClicks, setDeadClicks] = useState<{ items: FrustrationElement[]; total: number }>({ items: [], total: 0 }) const [byPage, setByPage] = useState([]) const [loading, setLoading] = useState(true) + const [error, setError] = useState(false) const refreshRef = useRef | null>(null) // Fetch dashboard data for scroll depth (goal_counts + stats) @@ -70,7 +71,9 @@ export default function BehaviorPage() { setRageClicks(rageData) setDeadClicks(deadData) setByPage(pageData) + setError(false) } catch { + setError(true) toast.error('Failed to load behavior data') } finally { setLoading(false) @@ -185,14 +188,16 @@ export default function BehaviorPage() { {/* By page breakdown */} - {/* Scroll depth + Frustration trend */} -
- - -
+ {/* Scroll depth + Frustration trend — hide when data failed to load */} + {!error && ( +
+ + +
+ )}