1
+ import { cache } from 'react'
1
2
import { ToastContainer } from 'react-toastify'
2
- import { unstable_cache } from 'next/cache'
3
3
import type { Viewport } from 'next'
4
4
import type { PropsWithChildren } from 'react'
5
5
@@ -14,7 +14,7 @@ import { AccentColorStyleInjector } from '~/components/modules/shared/AccentColo
14
14
import { SearchPanelWithHotKey } from '~/components/modules/shared/SearchFAB'
15
15
import { TocAutoScroll } from '~/components/modules/toc/TocAutoScroll'
16
16
import { attachUAAndRealIp } from '~/lib/attach-ua'
17
- import { getOrSetCache } from '~/lib/cache'
17
+ import { onlyGetOrSetCacheInVercelButFallback } from '~/lib/cache'
18
18
import { sansFont , serifFont } from '~/lib/fonts'
19
19
import { getQueryClient } from '~/lib/query-client.server'
20
20
import { AggregationProvider } from '~/providers/root/aggregation-data-provider'
@@ -43,23 +43,19 @@ export function generateViewport(): Viewport {
43
43
}
44
44
45
45
const key = 'root-data'
46
- const fetchAggregationData = unstable_cache (
47
- async ( ) => {
48
- const queryClient = getQueryClient ( )
46
+ const fetchAggregationData = cache ( async ( ) => {
47
+ const queryClient = getQueryClient ( )
49
48
50
- return getOrSetCache (
51
- key ,
52
- async ( ) => {
53
- attachUAAndRealIp ( )
49
+ return onlyGetOrSetCacheInVercelButFallback (
50
+ key ,
51
+ async ( ) => {
52
+ attachUAAndRealIp ( )
54
53
55
- return queryClient . fetchQuery ( queries . aggregation . root ( ) )
56
- } ,
57
- revalidate ,
58
- )
59
- } ,
60
- [ key ] ,
61
- { revalidate } ,
62
- )
54
+ return queryClient . fetchQuery ( queries . aggregation . root ( ) )
55
+ } ,
56
+ revalidate ,
57
+ )
58
+ } )
63
59
export const generateMetadata = async ( ) => {
64
60
const fetchedData = await fetchAggregationData ( )
65
61
0 commit comments