Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic data pretending to be static #43

Open
oliverjam opened this issue Dec 10, 2021 · 0 comments
Open

Dynamic data pretending to be static #43

oliverjam opened this issue Dec 10, 2021 · 0 comments

Comments

@oliverjam
Copy link

export async function getStaticProps({ params }) {
const { data, error } = await supabase.from('classes').select('name');
return {
props: {
data,
},
};
}

Be careful about telling Next.js that a page is static. This means its data/props will only ever update when you deploy your app.

In this case you're fetching information from your Supabase database (Postgres), which could be updated at any time. E.g. if someone logs in to your Supabase admin and adds a new class. Your page would then have old out-of-date props until your next deploy.

When you have dynamic data like this it's safer to use getServerSideProps, since then Next.js will fetch the data fresh on every page load.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant