-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix error when accessing some not found pages
Fix GITBOOK-OPEN-1XDB Fix GITBOOK-OPEN-1XDC Fix GITBOOK-OPEN-1X07 Fix GITBOOK-OPEN-1XCJ Fix GITBOOK-OPEN-1X86
- Loading branch information
Showing
9 changed files
with
116 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'gitbook': patch | ||
--- | ||
|
||
Fix error when accessing some not found pages. |
18 changes: 17 additions & 1 deletion
18
packages/gitbook/src/app/(site)/(content)/[[...pathname]]/not-found.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,30 @@ | ||
import { CustomizationRootLayout } from '@/components/RootLayout'; | ||
import { getSiteData } from '@/lib/api'; | ||
import { checkIsFromMiddleware } from '@/lib/pages'; | ||
import { getSiteContentPointer } from '@/lib/pointer'; | ||
|
||
/** | ||
* Layout to be used for the site root. It fetches the customization data for the site | ||
* and initializes the CustomizationRootLayout with it. | ||
*/ | ||
export default async function SiteRootLayout(props: { children: React.ReactNode }) { | ||
const { children } = props; | ||
const fromMiddleware = await checkIsFromMiddleware(); | ||
if (!fromMiddleware) { | ||
return ( | ||
<html lang="en"> | ||
<body className="font-[sans-serif]"> | ||
<main>{props.children}</main> | ||
</body> | ||
</html> | ||
); | ||
} | ||
|
||
const pointer = await getSiteContentPointer(); | ||
const { customization } = await getSiteData(pointer); | ||
|
||
return ( | ||
<CustomizationRootLayout customization={customization}>{children}</CustomizationRootLayout> | ||
<CustomizationRootLayout customization={customization}> | ||
{props.children} | ||
</CustomizationRootLayout> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters