refactor: streamline data loading in FunnelsPage and FunnelReportPage by reintroducing useEffect hooks for improved state management and responsiveness

This commit is contained in:
Usman Baig
2026-02-04 23:17:17 +01:00
parent 252b023f0d
commit 8bbe508657
2 changed files with 14 additions and 14 deletions

View File

@@ -16,10 +16,6 @@ export default function FunnelsPage() {
const [funnels, setFunnels] = useState<Funnel[]>([])
const [loading, setLoading] = useState(true)
useEffect(() => {
loadFunnels()
}, [siteId])
const loadFunnels = async () => {
try {
setLoading(true)
@@ -32,6 +28,10 @@ export default function FunnelsPage() {
}
}
useEffect(() => {
loadFunnels()
}, [siteId])
const handleDelete = async (e: React.MouseEvent, funnelId: string) => {
e.preventDefault() // Prevent navigation
if (!confirm('Are you sure you want to delete this funnel?')) return