Next js revalidation in server components on production build

52 Views Asked by At

I am having trouble with Next.js revalidation. So basically I have a main app and its dashboard. The dashboard update the database which ideally should reflect in the main app. But as next.js creates static routes, no such changes are reflected in the main app.

Here is my current code:

import Image from "next/image";
import { connectionStr } from "@/utils/db";
import { Profiles } from "@/utils/model/profilesModel";
import mongoose from "mongoose";
export const revalidate=10;
const getData = async () => {
    await mongoose.connect(connectionStr);
    const data=await Profiles.find({ type: 'team' });
    return data;
};
async function Team() {
    let data = await getData();
    .......
}

The revalidate method is not working as expected. GetStaticProps and GetServerSideProps is deprecated. Also not that I am not fetching anything so next:revalidate is also not an option. Any help is appreciated.

0

There are 0 best solutions below