Next.js Discord

Discord Forum

Why does third party cache re-fetch on reload?

Unanswered
Silver carp posted this in #help-forum
Open in Discord
Silver carpOP
Hey! I'm using supabase and I'm using the react function cache for 3rd party caching, I noticed that when I reload the page it doesn't return any cached data?

6 Replies

Silver carpOP
then when I reload it:
different data?
export const getCollegeRecommendations = cache(async (profile: Tables<"users">) => {
  const preferredMajors = JSON.parse(profile.preferredMajors);
  const preferredDivisions = JSON.parse(profile.preferredCollegeDivisions);

  const colleges = await supabase
    .from("colleges")
    .select("name, state, city, img, division")
    .in("division", preferredDivisions)
    .overlaps("fieldsOfStudy", preferredMajors)
    .overlaps("sports", [profile.preferredCollegeSport]);

  const shuffled = colleges.data?.sort(() => 0.5 - Math.random());
  return shuffled?.slice(0, 3);
});
// * Renders the dashboard 
export default async function Dashboard(props: any) {
    const profile = await getProfile()
    const recommendations = await getCollegeRecommendations(profile);
    if (!recommendations) return;
  
  ...
tried messing with generateStaticParams and nothing