refactor: streamline data loading in FunnelsPage and FunnelReportPage by reintroducing useEffect hooks for improved state management and responsiveness
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user