From 0787818bc8fd2134db3f13f800ed166d52c65b97 Mon Sep 17 00:00:00 2001 From: PabloSz Date: Sat, 22 Aug 2020 17:28:23 -0400 Subject: [PATCH] share page loading since there isn't a spinner, just returning null, just like pages/dashboard.js --- pages/share/[...id].js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pages/share/[...id].js b/pages/share/[...id].js index 15b911d4..21005a53 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 ; }