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
rolespage (/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.tsxlookS 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/26page withuseStatehook, however when I click the breadcrumb to/main/rolepage and click the same user again to/main/roles/26. ThefetchRoleDetailfunction 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/rolesto/main/roles/26the[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.fetchRoleDetailfunction still returns the user as "staff" not "supervisor" only in the frontend, the backend indeed already returns supervisor as I checked it via PostmanfetchnotaxiosfetchRoleDetailto refetch without cache every time we go back to the page.Additional information
Beta Was this translation helpful? Give feedback.
All reactions