ISnackable / saf-duty

saf-duty; A Duty Roster planner for the Singapore Armed Forces (SAF). It's tailored for military uses. GPL-3.0 License.
https://afpn-cdo.vercel.app
GNU General Public License v3.0
2 stars 1 forks source link

BUG: Stale data when switching user account #7

Closed ISnackable closed 1 year ago

ISnackable commented 1 year ago

When switching to another account, for example demo to user. This only seem to happen on safari browser, on ios. The pages will show the demo user's data instead of the user's data. It requires a manual refresh for the data to show.

A potential fix is to remove the @lib/demo.data file, and just query the demo data from sanity.

Edit: This might have to do with an issue with next-auth session not updating/clearing properly. See https://github.com/nextauthjs/next-auth/issues/4612

ISnackable commented 1 year ago

Upon further investigation, it may have to something to do with caching. This is apparent when user add new block outs dates, navigate to other page, and return back to manage blockout page, the blockout is using the previous value.

User must either reload the page, or navigate to other page and back.

ISnackable commented 1 year ago

Maybe I should use CSR and SWR/react-query to fetch data, instead of SSR on every page