Next.js Discord

Discord Forum

pages won't render without an empty getServerSideProps

Unanswered
Asian black bear posted this in #help-forum
Open in Discord
Avatar
Asian black bearOP
I have a sanity studio embedded in my next js app at pages/studio/[[...index]].tsx like so:
import Head from "next/head";
import { NextStudio } from "next-sanity/studio";
import { NextStudioHead } from "next-sanity/studio/head";
import { StudioLayout, StudioProvider } from "sanity";
import config from "../../../sanity.config";
import { createGlobalStyle } from "styled-components";

const GlobalStyle = createGlobalStyle(({ theme }) => ({
    html: { backgroundColor: theme.sanity.color.base.bg },
}));

export default function StudioPage() {
    return (
        <>
            <Head>
                <NextStudioHead favicons={false} />
            </Head>

            <NextStudio config={config}>
                <StudioProvider config={config}>
                    <GlobalStyle />
                    <StudioLayout />
                </StudioProvider>
            </NextStudio>
        </>
    );
}

export async function getServerSideProps() {
    return {
        props: {},
    };
}


With the code above the page renders as expected, but when I remove the getServerSideProps, nothing renders, there are no errors that appear anywhere, what could be causing this?

0 Replies