Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
fix blank screen by using router.replace instead of redirect in useEffect
Mike Cao80fee9f3218e
diff --git a/src/app/page.tsx b/src/app/page.tsxindex 6f0033dff..908b63cc6 100644--- a/src/app/page.tsx+++ b/src/app/page.tsx@@ -1,19 +1,21 @@'use client';-import { redirect } from 'next/navigation';+import { useRouter } from 'next/navigation';import { useEffect } from 'react';import { LAST_TEAM_CONFIG } from '@/lib/constants';import { getItem } from '@/lib/storage';export default function RootPage() {+ const router = useRouter();+useEffect(() => {const lastTeam = getItem(LAST_TEAM_CONFIG);if (lastTeam) {- redirect(`/teams/${lastTeam}/websites`);+ router.replace(`/teams/${lastTeam}/websites`);} else {- redirect(`/websites`);+ router.replace(`/websites`);}- }, []);+ }, [router]);return null;}