docs: fixes and refactoring for API reference (#9708)

* docs: fixes and refactoring for API reference

* add route caching

* remove caching

* use next cache
This commit is contained in:
Shahed Nasser
2024-10-22 18:20:06 +03:00
committed by GitHub
parent 6b989353ac
commit b2122c4073
20 changed files with 377 additions and 277 deletions

View File

@@ -3,12 +3,9 @@
import {
SidebarProvider as UiSidebarProvider,
usePageLoading,
usePrevious,
useScrollController,
} from "docs-ui"
import { config } from "../config"
import { useCallback } from "react"
import { usePathname } from "next/navigation"
type SidebarProviderProps = {
children?: React.ReactNode
@@ -17,13 +14,6 @@ type SidebarProviderProps = {
const SidebarProvider = ({ children }: SidebarProviderProps) => {
const { isLoading, setIsLoading } = usePageLoading()
const { scrollableElement } = useScrollController()
const pathname = usePathname()
const prevPathName = usePrevious(pathname)
const resetOnCondition = useCallback(
() => prevPathName !== undefined && pathname !== prevPathName,
[pathname, prevPathName]
)
return (
<UiSidebarProvider
@@ -32,7 +22,6 @@ const SidebarProvider = ({ children }: SidebarProviderProps) => {
shouldHandleHashChange={true}
scrollableElement={scrollableElement}
initialItems={config.sidebar}
resetOnCondition={resetOnCondition}
persistState={false}
projectName="api"
>