I have 2 json files, /data/contentDownloads.json and /data/links.json
This is my helper to get the json files
import { unstable_cache } from "next/cache";
export async function getJson(
fileName: string,
tag?: string,
revalidate?: number
) {
const content = unstable_cache(
async () => {
const file = await fs.readFile(
process.cwd() + `/data${fileName}.json`,
"utf8"
);
const locContent = JSON.parse(file);
return locContent;
},
["json"],
{
tags: tag ? [tag] : ["data"],
revalidate: revalidate ? revalidate : false,
}
)();
return content;
}
I need the tags so I can revalidate them. Now if I call the function with /contentDownloads, "content" I get the correct data and can also revalidate correctly, but doing "links", "link" provides the same data as the content one, any idea why this seems to be happening?