Skip to content

armgit / umami

Public Imported from GitHub
0

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.

share page loading

PabloSz0787818bc8fd
diff --git a/pages/share/[...id].js b/pages/share/[...id].js
index 15b911d49..21005a53e 100644
--- a/pages/share/[...id].js
+++ b/pages/share/[...id].js
@@ -6,6 +6,7 @@ import NotFound from 'pages/404';
import { get } from 'lib/web';
export default function SharePage() {
+ const [loading, setLoading] = useState(true);
const [websiteId, setWebsiteId] = useState();
const [notFound, setNotFound] = useState(false);
const router = useRouter();
@@ -23,10 +24,16 @@ export default function SharePage() {
useEffect(() => {
if (id) {
- loadData();
+ loadData().finally(() => {
+ setLoading(false);
+ });
+ } else {
+ setLoading(false);
}
}, [id]);
+ if (loading) return null;
+
if (!id || notFound) {
return <NotFound />;
}