Nextjs 14 App router Revalidate switches the updated data and current data on each refresh
Unanswered
Saltwater Crocodile posted this in #help-forum
Saltwater CrocodileOP
when I Deploy my app on aws-amplify with a revalidate of 4s, when i refresh the page after 4s, it shows the latest data, when I refresh again, it shows the previous data. I declared revalidate on the page
Here my fetch function,
Here my fetch function,
async function fetchEndpoint(query = "", { variables } = {}) {
const res = await fetch("https://apibkofc.globalvoices.com/graphql", {
method: "post",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
query,
variables,
}),
});
if (!res.ok) {
console.error(res);
return {};
}
const { data } = await res.json();
return data;
}