File tree 2 files changed +13
-4
lines changed
packages/docs/src/app/(pages)/_landing/dependents
2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ enum PackageId {
5
5
nextUseQueryState = 'UGFja2FnZS0xMTYwOTg5NDIx'
6
6
}
7
7
8
- type Result = {
8
+ export type Result = {
9
9
repo : string
10
10
stars : number
11
11
pkg : string
@@ -47,7 +47,9 @@ async function crawlDependentsPage(url: string) {
47
47
new URLSearchParams ( url . split ( '?' ) [ 1 ] ) . get ( 'package_id' ) === PackageId . nuqs
48
48
? 'nuqs'
49
49
: 'next-usequerystate'
50
- const html = await fetch ( url ) . then ( res => res . text ( ) )
50
+ const html = await fetch ( url , {
51
+ cache : 'no-store'
52
+ } ) . then ( res => res . text ( ) )
51
53
const $ = cheerio . load ( html )
52
54
const results : Result [ ] = [ ]
53
55
$ ( '[data-test-id="dg-repo-pkg-dependent"]' ) . each ( ( index , element ) => {
Original file line number Diff line number Diff line change 1
1
import { cn } from '@/src/lib/utils'
2
2
import Image from 'next/image'
3
- import { crawlDependents } from './crawler'
3
+ import type { Result } from './crawler'
4
4
5
5
export async function DependentsSection ( ) {
6
- const dependents = await crawlDependents ( )
6
+ const dependents : Result [ ] = await fetch (
7
+ 'https://nuqs.47ng.com/api/dependents' ,
8
+ {
9
+ next : {
10
+ revalidate : 86_400
11
+ }
12
+ }
13
+ ) . then ( res => res . json ( ) )
7
14
return (
8
15
< section className = "container" >
9
16
< h2 className = "mb-8 text-center text-3xl font-bold tracking-tighter dark:text-white md:text-4xl xl:text-5xl" >
You can’t perform that action at this time.
0 commit comments