From 7e66a50a0683e118ffff20d159b11a80c5364889 Mon Sep 17 00:00:00 2001 From: Espen Hovlandsdal Date: Thu, 17 Dec 2020 13:24:38 +0100 Subject: [PATCH] [cms-sanity] Fix hook being called conditionally --- examples/cms-sanity/pages/posts/[slug].js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/cms-sanity/pages/posts/[slug].js b/examples/cms-sanity/pages/posts/[slug].js index 9ba7d14292edda..29710201c716b9 100644 --- a/examples/cms-sanity/pages/posts/[slug].js +++ b/examples/cms-sanity/pages/posts/[slug].js @@ -21,9 +21,6 @@ import { export default function Post({ data, preview }) { const router = useRouter() - if (!router.isFallback && !data.post?.slug) { - return - } const { data: { post, morePosts }, @@ -33,6 +30,10 @@ export default function Post({ data, preview }) { enabled: preview, }) + if (!router.isFallback && !data.post?.slug) { + return + } + return (