Next.js revalidate
, force-dynamic
or no-cache/store
are not working for Dynamic Route on Next js App router (if the dynamic path is similar)
#67549
Unanswered
stanley355
asked this question in
App Router
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I access the
roles
page (/main/roles/page.tsx
) that shows a list of users then when I click one of the list it will redirect (withrouter.push()
) to/main/roles/[id]/page.tsx
. In this case, the pathname and is/main/roles/26
.The
/main/roles/[id]/page.tsx
lookS like this:The issue comes when I updated the user role e.g. (from "staff" to "supervisor"). It was updated on the client side on
/main/roles/26
page withuseState
hook, however when I click the breadcrumb to/main/role
page and click the same user again to/main/roles/26
. ThefetchRoleDetail
function still returns the user as "staff" not "supervisor". It persists on returning "staff" no matter how many times go back and forth with The breadcrumb, user list, or going to another page. It will return as "supervisor" only if I refresh the page via browser.Notes:
/main/roles
to/main/roles/26
the[id]
we go back and forth should be the same to reproduce this issue. If we went to/main/roles/27
, it fetches another data.fetchRoleDetail
function still returns the user as "staff" not "supervisor" only in the frontend, the backend indeed already returns supervisor as I checked it via Postmanfetch
notaxios
fetchRoleDetail
to refetch without cache every time we go back to the page.Additional information
Beta Was this translation helpful? Give feedback.
All reactions