Next.js Discord

Discord Forum

cache problems next 14 server components

Unanswered
Blanc de Hotot posted this in #help-forum
Open in Discord
Blanc de HototOP
I'm using an OpenAPI generated ApiClient in a next.js project. And the problem is that the server components doesnt revaluate the data. If I change it to a client component, it does. The project is an e-commerce with stock status etc, so it's important that it's not stale info.

const productData = await ApiClient.product.productGetById(params.productId);

productData values are the same as the first time it got fetched and wont change. How can I change this? I'm not much into the ApiClient, it got installed by the backend dev in out team and I cant contact him right now.

I can see that next.js uses cache automatically on a server component, and you can set an object with the cash property to put into the fetch call, but I'm not using fetch.

Any ideas?

0 Replies