upleveled / next-js-example-spring-2023-atvie

https://next-js-example-spring-2023-vienna-austria.fly.dev/
8 stars 5 forks source link

Remove unnecessary `router.refresh()` usage #9

Closed karlhorky closed 1 year ago

karlhorky commented 1 year ago

Since Next.js 13.4.6, calling cookies().set() in a Server Action invalidates the client cache:

This means that we no longer need to call router.refresh() anymore, which means we can:

ProchaLu commented 1 year ago

we found an issue with this: cookies().set(...) no longer clears the client cache starting in next@13.4.11-canary.1 :

karlhorky commented 1 year ago

@ProchaLu seems like this was fixed with tests:

Can you upgrade and test again?

ProchaLu commented 1 year ago

Upgraded my test project and tested cookie(set) and cookie(get) again. Everything works as expected now without refreshing the page.

https://github.com/upleveled/next-js-example-spring-2023-vienna-austria/assets/80746311/c06e1009-2d8b-4c85-b624-de84f2cfc96b