Skip to content

Commit 5afb93b

Browse files
authored
doc: revert cacheComponents (#1205)
1 parent 08cd69c commit 5afb93b

File tree

23 files changed

+48
-165
lines changed

23 files changed

+48
-165
lines changed

.github/workflows/ci-cd.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ jobs:
109109
- name: Build docs
110110
run: pnpm run build --filter docs
111111
env:
112-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113112
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
114113
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
115114
- uses: 47ng/actions-slack-notify@main

packages/docs/content/docs/community-adapters/inertia-adapter-source.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { CodeBlock } from '@/src/components/code-block'
22
import { SiTypescript } from '@icons-pack/react-simple-icons'
3-
import { cacheLife } from 'next/cache'
43

54
export async function InertiaAdapterSource() {
6-
'use cache'
7-
cacheLife('static')
85
const source = await fetch(
96
'https://raw.githubusercontent.com/47ng/nuqs-inertia-pingcrm/refs/heads/with-nuqs/resources/js/lib/nuqs-inertia-adapter.ts'
107
).then(res => res.text())

packages/docs/content/docs/parsers/community/zod-codecs.source.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { CodeBlock } from '@/src/components/code-block'
2-
import { cacheLife } from 'next/cache'
32
import { readFile } from 'node:fs/promises'
43

54
export async function ZodCodecsSource() {
6-
'use cache'
7-
cacheLife('static')
85
const filePath =
96
process.cwd() + '/content/docs/parsers/community/zod-codecs.lib.ts'
107
const source = await readFile(filePath, 'utf8')

packages/docs/next.config.mjs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,7 @@ const config = {
2222
]
2323
},
2424
reactCompiler: true,
25-
cacheComponents: true,
2625
reactStrictMode: true,
27-
cacheLife: {
28-
static: {
29-
// Only changes on new deploys, assuming we at least deploy once a year
30-
stale: 300, // 5 minutes for the client cache
31-
revalidate: 365 * 24 * 60 * 60,
32-
expire: 366 * 24 * 60 * 60 // 1 year + 1 day (has to be greater than revalidate)
33-
}
34-
},
3526
turbopack: {
3627
debugIds: enableSentry
3728
},

packages/docs/src/app/(pages)/_landing/bundle-size.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { cacheLife } from 'next/cache'
21
import fs from 'node:fs/promises'
32
import path from 'node:path'
43

@@ -14,8 +13,6 @@ function prettyBytes(size: number) {
1413
}
1514

1615
export async function BundleSize() {
17-
'use cache'
18-
cacheLife('static') // Only changes on new deploys
1916
const filePath = path.resolve(process.cwd(), '../../packages/nuqs/size.json')
2017
try {
2118
const json = await fs.readFile(filePath, 'utf8')

packages/docs/src/app/(pages)/_landing/contributors.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { cn } from '@/src/lib/utils'
2-
import { cacheLife, cacheTag } from 'next/cache'
32
import { z } from 'zod'
43

54
const contributorSchema = z.object({
@@ -30,7 +29,10 @@ async function fetchContributors(): Promise<Contributor[]> {
3029
// anon=false by default; we only want registered users
3130

3231
const res = await fetch(url.toString(), {
33-
headers
32+
headers,
33+
next: {
34+
tags: ['contributors']
35+
}
3436
})
3537

3638
if (!res.ok) {
@@ -102,9 +104,6 @@ async function fetchContributors(): Promise<Contributor[]> {
102104
}
103105

104106
export async function ContributorsSection() {
105-
'use cache'
106-
cacheLife('static')
107-
cacheTag('contributors')
108107
let contributors: Contributor[] = []
109108
try {
110109
contributors = await fetchContributors()

packages/docs/src/app/(pages)/_landing/demo.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import { CodeBlock } from '@/src/components/code-block'
2-
import { cacheLife } from 'next/cache'
32
import fs from 'node:fs/promises'
43
import { format } from 'prettier'
54
import { Suspense } from 'react'
65
import { Demo } from './demo.client'
76

87
export async function LandingDemo() {
9-
'use cache'
10-
cacheLife('static') // Only changes on new deploys
118
const demoFilePath =
129
process.cwd() + '/src/app/(pages)/_landing/demo.client.tsx'
1310
const demoFile = await fs.readFile(demoFilePath, 'utf8')

packages/docs/src/app/(pages)/_landing/dependents.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { cn } from '@/src/lib/utils'
2-
import { cacheLife } from 'next/cache'
32
import { z } from 'zod'
43

54
const dependentSchema = z.object({
@@ -14,9 +13,11 @@ const dependentSchema = z.object({
1413
type Dependent = z.infer<typeof dependentSchema>
1514

1615
export async function fetchDependents() {
17-
const data = await fetch('https://dependents.47ng.com').then(res =>
18-
res.json()
19-
)
16+
const data = await fetch('https://dependents.47ng.com', {
17+
next: {
18+
revalidate: 86_400 // 24 hours
19+
}
20+
}).then(res => res.json())
2021
return z.array(dependentSchema).parse(data)
2122
}
2223

@@ -134,8 +135,6 @@ function SponsoredUsedBy() {
134135
}
135136

136137
async function DependentsLeaderboard() {
137-
'use cache'
138-
cacheLife('hours')
139138
let dependents: Dependent[] = []
140139
try {
141140
dependents = await fetchDependents()

packages/docs/src/app/(pages)/_landing/gha-status.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
import { cn } from '@/src/lib/utils'
2-
import { cacheLife, cacheTag } from 'next/cache'
32
import React from 'react'
43
import { z } from 'zod'
54

65
export async function GitHubActionsStatus({
76
className,
87
...props
98
}: React.ComponentProps<'div'>) {
10-
'use cache'
11-
cacheLife('hours')
12-
cacheTag('github-actions-status')
139
const statuses = await getGitHubActionsStatus()
1410
if (statuses.length === 0) {
1511
return null
@@ -91,7 +87,10 @@ async function getGitHubActionsStatus() {
9187
headers: {
9288
Authorization: `bearer ${process.env.GITHUB_TOKEN}`
9389
},
94-
body: JSON.stringify({ query })
90+
body: JSON.stringify({ query }),
91+
next: {
92+
tags: ['github-actions-status']
93+
}
9594
}).then(res => res.json())
9695
debugInfo = json
9796

packages/docs/src/app/(pages)/blog/[slug]/opengraph-image.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { blog } from '@/src/app/source'
2-
import { cacheLife } from 'next/cache'
32
import { notFound } from 'next/navigation'
43
import { ImageResponse } from 'next/og'
54
import { readFile } from 'node:fs/promises'
@@ -12,6 +11,7 @@ export const size = {
1211
height: 675
1312
}
1413
export const contentType = 'image/png'
14+
export const dynamic = 'force-static'
1515

1616
type PageProps = {
1717
params: Promise<{ slug: string }>
@@ -181,8 +181,6 @@ function getFont(weight: string) {
181181
}
182182

183183
async function loadResources() {
184-
'use cache'
185-
cacheLife('static')
186184
const [light, regular, medium, semibold, bold] = await Promise.all([
187185
getFont('Light'),
188186
getFont('Regular'),
@@ -263,8 +261,6 @@ function Logo(props: ComponentProps<'svg'>) {
263261
}
264262

265263
async function getCustomImage(slug: string) {
266-
'use cache'
267-
cacheLife('static')
268264
const filePath = join(process.cwd(), 'content/blog/' + slug + '.og.png')
269265
try {
270266
const imageBuffer = await readFile(filePath)

0 commit comments

Comments
 (0)