#Getting 304 Not Modified for page and getting always stale data

5 messages · Page 1 of 1 (latest)

cinder slate
#

I'm using unstable_cache to revalidate some operations/external calls for X hours. When I deployed for the first time everything was correct, even after the first revalidation. After that, I started seeing that the page was always containing the stale data and via network I see the response status 304 (not modified) for that page. Anyone knows what's going on? If I redeploy it will start working.

Thanks in advance!

plain etherBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

cinder slate
#

@crystal pulsar 🙏 , basically this:` "use server";

import { unstable_cache as cache } from "next/cache";
import { parseCompaniesData } from "../parser";

export const getParsedCompaniesData = cache(
async () => {
const data = await parseCompaniesData();
const updatedAtISODate = new Date().toISOString();

return {
  companies: data.companies,
  availableLocations: data.availableLocations,
  availableCategories: data.availableCategories,
  updatedAtISODate,
};

},
["companies"],
{
revalidate: 21600, // 6 hours
},
);

export const getParsedCompanyBySlug = async (slug: string) => {
const { companies } = await getParsedCompaniesData();

return companies.find((company) => company.slug === slug);
};
`

#

and then i'm using this in a root page /: