So this is my api call function:
export const getList = async (): Promise<
ListType | undefined
> => {
try {
const response = await fetch(`${API_URL}/list`, {
cache: "force-cache",
next: {
tags: ["list"],
},
headers: {
Authorization: AUTH_HEADER,
},
});
const data: ListType = await response.json();
return data;
} catch (error: unknown) {
console.error(`Error fetching list: ${error}`);
return;
}
};
I call this in a React Server Component like
const data = await getList();
but in my logs I get this info:
2024-11-11 11:51:02 │ GET https://some-url.com/api/hosts/r34234e23423/list 200 in 447ms (cache skip)
2024-11-11 11:51:02 │ │ Cache skipped reason: (cache-control: no-cache (hard refresh))
I also tried to wrap the whole getList function in react.cache which is also not working.
what am I missing?