Static regeneration validation
Answered
Ojos Azules posted this in #help-forum
Ojos AzulesOP
Is there a way to validate new data with static regeneration and keep old data if new data doesn’t pass validation. (App dir)
Answered by fuma
It depends on how you revalidate the data, for example, on-demand revalidation allows you to check the data before calling
You may also throw an error in the page when the response is invalid,
revalidatePath/revalidateTag.You may also throw an error in the page when the response is invalid,
6 Replies
It depends on how you revalidate the data, for example, on-demand revalidation allows you to check the data before calling
You may also throw an error in the page when the response is invalid,
revalidatePath/revalidateTag.You may also throw an error in the page when the response is invalid,
Answer
Next.js keeps the old cache if failed to revalidate
@fuma Next.js keeps the old cache if failed to revalidate
Ojos AzulesOP
Is there a way to fail the revalidation from the route?
So if I revalidateTag but doing so throws an error in a page will it revert to old cache?
If it fails to revalidate your page, Next.js will keep the old cache/page