Skip to content

Commit

Permalink
DN-4: Testing ISR only pre-render some and the others are incremental…
Browse files Browse the repository at this point in the history
…ly rendered as people visit the site.
  • Loading branch information
dereckmezquita committed Jul 15, 2024
1 parent 7c9f4fd commit e5cdca5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 7 additions & 3 deletions client/src/app/dictionaries/biology/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ const relDir: string = path.join('dictionaries', dictionary, 'definitions');
const absDir: string = path.join(ROOT_DIR_APP, relDir);

export async function generateStaticParams(): Promise<{ slug: string }[]> {
const filenames: string[] = fs.readdirSync(absDir).filter((filename) => {
return filename.endsWith('.mdx');
});
// only pre-render first 3 definitions
const filenames: string[] = fs
.readdirSync(absDir)
.filter((filename) => {
return filename.endsWith('.mdx');
})
.slice(0, 3);

return filenames.map((filename) => {
const slug = path.basename(filename, '.mdx');
Expand Down
10 changes: 7 additions & 3 deletions client/src/app/dictionaries/chemistry/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ const relDir: string = path.join('dictionaries', dictionary, 'definitions');
const absDir: string = path.join(ROOT_DIR_APP, relDir);

export async function generateStaticParams(): Promise<{ slug: string }[]> {
const filenames: string[] = fs.readdirSync(absDir).filter((filename) => {
return filename.endsWith('.mdx');
});
// only pre-render first 3 definitions
const filenames: string[] = fs
.readdirSync(absDir)
.filter((filename) => {
return filename.endsWith('.mdx');
})
.slice(0, 3);

return filenames.map((filename) => {
const slug = path.basename(filename, '.mdx');
Expand Down

0 comments on commit e5cdca5

Please sign in to comment.