fix: render loading spinner if no hash

This commit is contained in:
Christel Westerberg
2024-02-12 16:35:24 +01:00
parent a6475aaa97
commit fc06d116fd
8 changed files with 38 additions and 29 deletions

View File

@@ -4,7 +4,7 @@ import { GetCurrentBlockPage } from "@/lib/graphql/Query/CurrentBlockPage.graphq
import type { PageArgs, LangParams, UriParams } from "@/types/params"
import type { GetCurrentBlockPageData } from "@/types/requests/currentBlockPage"
import ContentstackLivePreview from "@contentstack/live-preview-utils"
import LoadingPreview from "@/components/Current/LoadingPreview"
import LoadingSpinner from "@/components/Current/LoadingSpinner"
import ContentPage from "@/components/Current/ContentPage"
export default async function CurrentContentPage({
@@ -14,8 +14,8 @@ export default async function CurrentContentPage({
try {
ContentstackLivePreview.setConfigFromParams(searchParams)
if (!searchParams.uri) {
return <LoadingPreview />
if (!searchParams.uri || !searchParams["live_preview"]) {
return <LoadingSpinner />
}
const response = await previewRequest<GetCurrentBlockPageData>(