vercel / next.js

The React Framework
https://nextjs.org
MIT License
127.02k stars 26.99k forks source link

Please give us ability to revalidate or disable router cache. #54514

Closed grogou closed 1 year ago

grogou commented 1 year ago

Verify canary release

Provide environment information

on any env

Which example does this report relate to?

with-next-routes

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

There is no way to clear route cache or revalidate it. In my case it is important to show updated data immediately, but this strange behavior ( also please describe why you are using that much aggressive caching ) broke whole app to work smooth.

Also if you don't want to do that and I can't understand why, please provide normal way to disable caching.

Don't provide stupid router.refresh please. It is not normal to do that in Nextjs or React.

If it is normal behavior for you we can leave this project and do Wordpress if it is normal to refresh page. Also in Wordpress they have Interativity API to not do page refresh, guys comoon.

Expected Behavior

GIVE US ABILITY TO DISABLE CACHE

To Reproduce

just use LAST and best version of Next.

From my side maybe it is too much aggressive sorry but caching too))

It is not normal. There is a lot of issues, videos, topics and all that people want to know how to disable it.

Why it is default behavior? Give us ability to choose.

Yes it is revalidating after 30 sec. but it is important in some projects to see updated data immediately.

Thank you)

ankitahuja1 commented 1 year ago

I tried to add these two configs separately to my route files to avoid caching. It works fine on local build. But when deployed to vercel my route response gives 500 error.

export const revalidate = 0 export const dynamic = 'auto'

balazsorban44 commented 1 year ago

This is not a bug report, so closing. About this topic, please read https://github.com/vercel/next.js/discussions/54075 and the associated issue to get more context.

Note: Please use the correct language in the future, and keep it constructive. Thanks

github-actions[bot] commented 1 year ago

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.