Add some safeguards to data and new button size

This commit is contained in:
Valtteri Karesto
2021-11-25 23:54:03 +02:00
parent 48706effc1
commit 6f183049d5
2 changed files with 14 additions and 7 deletions

View File

@@ -16,16 +16,17 @@ function MyApp({ Component, pageProps: { session, ...pageProps } }: AppProps) {
const router = useRouter();
const slug = router.query?.slug;
const gistId = (Array.isArray(slug) && slug[0]) ?? null;
useEffect(() => {
if (gistId && router.isReady) {
fetchFiles(gistId);
} else {
if (!gistId && router.isReady) {
state.mainModalOpen = true;
if (router.pathname.includes("/develop")) {
if (gistId && router.isReady) {
fetchFiles(gistId);
} else {
if (!gistId && router.isReady) {
state.mainModalOpen = true;
}
}
}
}, [gistId, router.isReady]);
}, [gistId, router.isReady, router.pathname]);
return (
<>