Skip to content

Commit

Permalink
docs(cacheLife): fix incorrect highlight and missing switcher (#72216)
Browse files Browse the repository at this point in the history
This PR fixes two issues on the
[cacheLife](https://nextjs.org/docs/canary/app/api-reference/functions/cacheLife)
documentation page:

1. Incorrect highlight for `biweekly` in [Defining reusable cache
profiles](https://nextjs.org/docs/canary/app/api-reference/functions/cacheLife#defining-reusable-cache-profiles)
section. It should highlight `biweekly` but not `export default async
function Page()`


![image](https://github.com/user-attachments/assets/f5b331cf-a5eb-41b0-8cba-08b2a2ff836d)

2. Missing `switcher` for TS and JS codeblock in [Defining cache
profiles
inline](https://nextjs.org/docs/canary/app/api-reference/functions/cacheLife#defining-cache-profiles-inline)
section. Codeblock is displayed twice


![image](https://github.com/user-attachments/assets/e618f806-674f-4c21-8e02-8c90dd2308a5)

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: Jiwon Choi <devjiwonchoi@gmail.com>
  • Loading branch information
Juneezee and devjiwonchoi authored Nov 3, 2024
1 parent 9409a46 commit aee9c1e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/02-app/02-api-reference/04-functions/cacheLife.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ module.exports = nextConfig

The example above caches for 14 days, checks for updates daily, and expires the cache after 14 days. You can then reference this profile throughout your application by its name:

```tsx filename="app/page.tsx" highlight={4}
```tsx filename="app/page.tsx" highlight={5}
'use cache'
import { unstable_cacheLife as cacheLife } from 'next/cache'

Expand Down Expand Up @@ -181,7 +181,7 @@ module.exports = nextConfig

For specific use cases, you can set a custom cache profile by passing an object to the `cacheLife` function:

```tsx filename="app/page.tsx" highlight={5-9}
```tsx filename="app/page.tsx" highlight={5-9} switcher
'use cache'
import { unstable_cacheLife as cacheLife } from 'next/cache'

Expand All @@ -196,7 +196,7 @@ export default async function Page() {
}
```

```jsx filename="app/page.js" highlight={5-9}
```jsx filename="app/page.js" highlight={5-9} switcher
'use cache'
import { unstable_cacheLife as cacheLife } from 'next/cache'

Expand Down

0 comments on commit aee9c1e

Please sign in to comment.