Why does router.refresh() use a cached version of the current page but redirect() doesnt?
Unanswered
Asiatic Lion posted this in #help-forum
Asiatic LionOP
I noticed after refactoring a router.refresh() to instead call redirect() in the server action instead greatly increased my bandwidth usage. It seems router.refresh() is smart and doesn't refresh the static javascript assets for the route, while redirect() does. Is there any way to work around this limitation? I'd like to go back to using 75% less bandwidth.
6 Replies
Asiatic LionOP
Also the reason for working on the refactor was seeing how leerob was using the redirect() pattern in server actions instead of calling router.refresh() like I had been doing.
@Asiatic Lion Also the reason for working on the refactor was seeing how leerob was using the redirect() pattern in server actions instead of calling router.refresh() like I had been doing.
Using revalidatePath/router. refresh() is the way to go
@Clown Using revalidatePath/router. refresh() is the way to go
Asiatic LionOP
Sorry, what do you mean by this?
If router.refresh() works for your usecase, just go with that
Asiatic LionOP
bump