Next.js Discord

Discord Forum

res.revalidate does not work after long process

Unanswered
Tofugrass posted this in #help-forum
Open in Discord
Avatar
I am using ISR in the pages router. I await Promise.all(promises) and then call await res.revalidate(`/league/${league.id}`).
After refreshing the page, I see the old values from before the promises resolved.
However, if I make a button that just calls res.revalidate(`/league/${league.id}`) and press this button after the promises resolve, then I do see the new data upon refresh.
Both calls to res.revalidate(`/league/${league.id}`) happen on the server with seemingly identical contexts.
How does res.revalidate() work? Why would it work in one case but not another?
Is the data too fresh? Do I need to wait a bit and then revalidate?

0 Replies