I'm currently working on a Google Docs/Notion clone as a project. The scenario in which this problem occurs is as follows:
- The user starts at the Dashboard page, where they can see their list of boards/documents and dates for each board describing when it was last opened.
- The user clicks on a board/document to go to its dynamic route
- The user clicks on the browsers back arrow rather than the web app's dedicated Dashboard navigation button.
- The user returns to the Dashboard, but "last opened" date is outdated and requires the user to perform a manual refresh.
If the user navigates back to the browser by means other than the back button, this problem does not arise. I've tried to utilize export const dynamic = 'force-dynamic' and export const revalidate = 0 to combat this issue, but it does not seem to make a difference. From what I've read online as well, there are plenty of other people who are not seeing success with these on-demand techniques.
I'm 99% sure that this is a caching problem. But I cannot think of any more ways to revalidate the cache on demand. I've tried converting the dashboard page into a client component to utilize the useEffect hook, but it requires me to perform state management with all of the boards/documents which is going to be a huge headache to implement, so I really rather not go down that route.
Any other suggestions for what I could do to combat this issue?
I attached a picture of my Dashboard page code. I am also using Supabase for my ORM, but I don't think this should affect anything. Please let me know if you need any additional information, thanks!