after integrate nextjs13 with next-intl, caching is not working #567
Unanswered
Brightlight0721
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
before I adopted next-intl, eventhough it is SSR, next.js13 did not fetching every time when I go back to the main page, once SSR, for certain amount of time, it did not fetching every time, but after the next-intl, it keeps fetching every single time when I go back to the main page..
`import { use, cache } from 'react'
import ProductList from './components/ProductList';
import Footer from '../../../../components/main/Footer';
const FetchingProducts = cache(async(pageParam, locale)=> {
const response = await fetch(
http://127.0.0.1:8000/api/product/list?page=${pageParam}&locale=${locale}
,{cache : 'no-store'}
);
return response.json()
});
const FetchingMainBanner = cache(async()=> {
const response = await fetch(
http://127.0.0.1:8000/api/shop/main/banner
,{cache : 'no-store'}
);
return response.json()
});
export async function generateMetadata({ params, searchParams }, parent) {
// fetch data
const seo = await fetch(
http://127.0.0.1:8000/api/seo/main
).then((res) => res.json())}
export default function Main({params: {locale}}) {
const productsData = use(FetchingProducts(1, locale))
const bannerData = use(FetchingMainBanner())
return (
);
}`
Beta Was this translation helpful? Give feedback.
All reactions