Skip to content
Discussion options

You must be logged in to vote

When calling the API route, the page should automatically display the fresh cached value without requiring a manual refresh, matching the server action behavior.

That's a misunderstanding there. Server Functions/Actions communicate with the client router to achieve this kind of thing, where they can do UI updates, or redirect based on some special headers returned from the Server Function.

An API Route or Router Handler, are a primitive escape hatch, to put it in another way, as far as they are concerned, the rest of your app doesn't exist. I think you'd need to do router.refresh after your fetch call to the API or Route Handler succeeds. They are nothing but a REST API call.

I'll revie…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@rRakarare
Comment options

@icyJoseph
Comment options

@rRakarare
Comment options

Answer selected by rRakarare
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants