fix: preview page transitions
This commit is contained in:
@@ -120,7 +120,7 @@ export const PostMeta: React.FC<{
|
||||
</UniLink>
|
||||
)}
|
||||
</div>
|
||||
{!(summary.isSuccess && !summary.data) && (
|
||||
{(summary.isLoading || summary.data) && (
|
||||
<div className="border rounded-xl mt-4 p-4 space-y-2">
|
||||
<div className="font-bold text-zinc-700 flex items-center">
|
||||
<LightBulbIcon className="inline w-4 h-4 mr-2 stroke-[2]" />
|
||||
|
||||
@@ -18,6 +18,7 @@ export const getServerSideProps = async (
|
||||
take?: number
|
||||
useStat?: boolean
|
||||
skipPages?: boolean
|
||||
preview?: boolean
|
||||
},
|
||||
) => {
|
||||
const domainOrSubdomain = ctx.params!.site as string
|
||||
@@ -39,7 +40,9 @@ export const getServerSideProps = async (
|
||||
queryClient,
|
||||
),
|
||||
new Promise(async (resolve, reject) => {
|
||||
if (pageSlug) {
|
||||
if (options?.preview) {
|
||||
// do nothing
|
||||
} else if (pageSlug) {
|
||||
try {
|
||||
const page = await fetchGetPage(
|
||||
{
|
||||
|
||||
@@ -4,6 +4,32 @@ import { useGetPage } from "~/queries/page"
|
||||
import type { ReactElement } from "react"
|
||||
import { useRouter } from "next/router"
|
||||
import { useGetSite } from "~/queries/site"
|
||||
import { GetServerSideProps } from "next"
|
||||
import { getServerSideProps as getLayoutServerSideProps } from "~/components/site/SiteLayout.server"
|
||||
import { serverSidePropsHandler } from "~/lib/server-side-props"
|
||||
import { QueryClient } from "@tanstack/react-query"
|
||||
|
||||
export const getServerSideProps: GetServerSideProps = serverSidePropsHandler(
|
||||
async (ctx) => {
|
||||
const queryClient = new QueryClient()
|
||||
const domainOrSubdomain = ctx.params!.site as string
|
||||
|
||||
const { props: layoutProps } = await getLayoutServerSideProps(
|
||||
ctx,
|
||||
queryClient,
|
||||
{
|
||||
preview: true,
|
||||
},
|
||||
)
|
||||
|
||||
return {
|
||||
props: {
|
||||
...layoutProps,
|
||||
domainOrSubdomain,
|
||||
},
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
function SitePagePage() {
|
||||
const router = useRouter()
|
||||
|
||||
Reference in New Issue
Block a user