File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ export async function generateStaticParams() {
2121}
2222
2323export async function generateMetadata ( { params} : PageProps ) : Promise < Metadata > {
24- 'use cache' ;
2524 const { slug} = await params ;
2625 return sectionPageMetadata ( {
2726 section : 'blog' ,
@@ -31,7 +30,6 @@ export async function generateMetadata({params}: PageProps): Promise<Metadata> {
3130}
3231
3332export default async function BlogPage ( { params} : PageProps ) {
34- 'use cache' ;
3533 const { slug} = await params ;
3634 return renderSectionPage ( {
3735 section : 'blog' ,
Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ export async function generateStaticParams() {
2121}
2222
2323export async function generateMetadata ( { params} : PageProps ) : Promise < Metadata > {
24- 'use cache' ;
2524 const { slug} = await params ;
2625 return sectionPageMetadata ( {
2726 section : 'community' ,
@@ -30,7 +29,6 @@ export async function generateMetadata({params}: PageProps): Promise<Metadata> {
3029}
3130
3231export default async function CommunityPage ( { params} : PageProps ) {
33- 'use cache' ;
3432 const { slug} = await params ;
3533 return renderSectionPage ( {
3634 section : 'community' ,
Original file line number Diff line number Diff line change @@ -19,13 +19,11 @@ export async function generateStaticParams() {
1919}
2020
2121export async function generateMetadata ( { params} : PageProps ) : Promise < Metadata > {
22- 'use cache' ;
2322 const { errorCode} = await params ;
2423 return { title : `Minified React error #${ errorCode } ` } ;
2524}
2625
2726export default async function ErrorDecoderPage ( { params} : PageProps ) {
28- 'use cache' ;
2927 const { errorCode} = await params ;
3028 const data = await loadErrorDecoderData ( errorCode ) ;
3129 return < ErrorDecoderView data = { data } pathname = { `/errors/${ errorCode } ` } /> ;
Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ export const metadata: Metadata = {
1414} ;
1515
1616export default async function ErrorDecoderIndex ( ) {
17- 'use cache' ;
1817 const data = await loadErrorDecoderData ( null ) ;
1918 return < ErrorDecoderView data = { data } pathname = "/errors" /> ;
2019}
Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ export async function generateStaticParams() {
2121}
2222
2323export async function generateMetadata ( { params} : PageProps ) : Promise < Metadata > {
24- 'use cache' ;
2524 const { slug} = await params ;
2625 return sectionPageMetadata ( {
2726 section : 'learn' ,
@@ -31,7 +30,6 @@ export async function generateMetadata({params}: PageProps): Promise<Metadata> {
3130}
3231
3332export default async function LearnPage ( { params} : PageProps ) {
34- 'use cache' ;
3533 const { slug} = await params ;
3634 return renderSectionPage ( {
3735 section : 'learn' ,
Original file line number Diff line number Diff line change @@ -13,13 +13,11 @@ import {buildPageMetadata} from 'lib/buildPageMetadata';
1313import { DocsPage } from './DocsPage' ;
1414
1515export async function generateMetadata ( ) : Promise < Metadata > {
16- 'use cache' ;
1716 const data = await readMarkdownPage ( [ ] ) ;
1817 return buildPageMetadata ( { data, pathname : '/' , section : 'home' } ) ;
1918}
2019
2120export default async function HomePage ( ) {
22- 'use cache' ;
2321 const data = await readMarkdownPage ( [ ] ) ;
2422 return (
2523 < DocsPage
Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ export async function generateStaticParams() {
2121}
2222
2323export async function generateMetadata ( { params} : PageProps ) : Promise < Metadata > {
24- 'use cache' ;
2524 const { slug} = await params ;
2625 return sectionPageMetadata ( {
2726 section : 'reference' ,
@@ -30,7 +29,6 @@ export async function generateMetadata({params}: PageProps): Promise<Metadata> {
3029}
3130
3231export default async function ReferencePage ( { params} : PageProps ) {
33- 'use cache' ;
3432 const { slug} = await params ;
3533 return renderSectionPage ( {
3634 section : 'reference' ,
Original file line number Diff line number Diff line change @@ -11,12 +11,10 @@ import type {RouteItem} from 'components/Layout/getRouteMeta';
1111import { renderSectionPage , sectionPageMetadata } from '../renderSectionPage' ;
1212
1313export async function generateMetadata ( ) : Promise < Metadata > {
14- 'use cache' ;
1514 return sectionPageMetadata ( { section : 'unknown' , segments : [ 'versions' ] } ) ;
1615}
1716
1817export default async function VersionsPage ( ) {
19- 'use cache' ;
2018 return renderSectionPage ( {
2119 section : 'unknown' ,
2220 segments : [ 'versions' ] ,
Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ export async function generateStaticParams() {
2121}
2222
2323export async function generateMetadata ( { params} : PageProps ) : Promise < Metadata > {
24- 'use cache' ;
2524 const { slug} = await params ;
2625 return sectionPageMetadata ( {
2726 section : 'unknown' ,
@@ -30,7 +29,6 @@ export async function generateMetadata({params}: PageProps): Promise<Metadata> {
3029}
3130
3231export default async function WarningPage ( { params} : PageProps ) {
33- 'use cache' ;
3432 const { slug} = await params ;
3533 return renderSectionPage ( {
3634 section : 'unknown' ,
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import 'server-only';
99import fs from 'fs' ;
1010import path from 'path' ;
1111import { promisify } from 'util' ;
12+ import { cacheLife } from 'next/cache' ;
1213
1314const readdir = promisify ( fs . readdir ) ;
1415const stat = promisify ( fs . stat ) ;
@@ -46,6 +47,8 @@ function getSegments(file: string): string[] {
4647export async function collectSectionPaths (
4748 section : string
4849) : Promise < string [ ] [ ] > {
50+ 'use cache' ;
51+ cacheLife ( 'max' ) ;
4952 const dir = path . join ( ROOT , section ) ;
5053 if ( ! fs . existsSync ( dir ) ) return [ ] ;
5154 const files = await getFiles ( dir , dir ) ;
@@ -64,6 +67,8 @@ export async function collectSectionPaths(
6467export async function collectFlatSectionSlugs (
6568 section : string
6669) : Promise < string [ ] > {
70+ 'use cache' ;
71+ cacheLife ( 'max' ) ;
6772 const dir = path . join ( ROOT , section ) ;
6873 if ( ! fs . existsSync ( dir ) ) return [ ] ;
6974 const entries = await readdir ( dir ) ;
You can’t perform that action at this time.
0 commit comments