mirror of
https://github.com/supabase/supabase.git
synced 2026-06-23 01:08:27 +08:00
Before: All pages have the Home nav menu in static HTML, which is blown away and replaced by the proper nav menu upon hydration. This leads to jankiness when the page first loads and an unpleasant flash of the wrong nav menu (especially obvious on the JavaScript ref page, which takes a long time to process and rerender the nav). Now: All pages have their correct nav menu in static HTML.
32 lines
960 B
TypeScript
32 lines
960 B
TypeScript
import { MenuId } from '~/components/Navigation/NavigationMenu/NavigationMenu'
|
|
import RefSectionHandler from '~/components/reference/RefSectionHandler'
|
|
import { flattenSections } from '~/lib/helpers'
|
|
import handleRefGetStaticPaths from '~/lib/mdx/handleRefStaticPaths'
|
|
import handleRefStaticProps from '~/lib/mdx/handleRefStaticProps'
|
|
|
|
import spec from '~/spec/cli_v1_commands.yaml' assert { type: 'yml' }
|
|
import cliCommonSections from '~/spec/common-cli-sections.json' assert { type: 'json' }
|
|
|
|
const sections = flattenSections(cliCommonSections)
|
|
const libraryPath = '/cli'
|
|
|
|
export default function CliRef(props) {
|
|
return (
|
|
<RefSectionHandler
|
|
menuId={MenuId.RefCli}
|
|
sections={sections}
|
|
spec={spec}
|
|
pageProps={props}
|
|
type="cli"
|
|
/>
|
|
)
|
|
}
|
|
|
|
export async function getStaticProps() {
|
|
return handleRefStaticProps(sections, libraryPath)
|
|
}
|
|
|
|
export async function getStaticPaths() {
|
|
return handleRefGetStaticPaths(sections)
|
|
}
|