Script Review page + SessionProvider #231
3 Participants
Notifications
Due Date
No due date set.
Depends on
#222 Fix thumbnails, reduce network activity, rate limiting, caching, script review page
StrafesNET/maps-service
Reference: StrafesNET/maps-service#231
Reference in New Issue
Block a user
Delete Branch "feature-script-review"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The session provider reduces the copy & pasted code found in the header & mapfix page by sharing session data across pages/elements.
Hopefully I've implemented SWR correctly 😸
Why is there
web/src/app/_components/SessionContext.tsxandweb/src/app/lib/session.ts? Are they multiple implementations of the same thing? This is easier to identify which code belongs to which feature, and thus what it might be used for, but there is still two features rolled into one PR here :Psession.tshandles the server-side fetching of session data. It's used inlayout.tsx(server component), to load the user's info before the page renders, which helps avoid the "login flash" issue.SessionContext.tsxis the way the client-side receives session info from the server using SWR. It initially uses the preloaded data from the server (via SWR'sfallback) and re-fetches the user's roles every 60 seconds to keep things up to date.Here's a diagram ChatGippity drew up:
yea um, this was implemented randomly while I was writing the script review page, I saw that different pages were manually requesting the user's roles so that's how it ended up in this PR
Re-fetching roles every 60 seconds is rather pointless considering they are cached for 30 minutes.
Closing as OBE
Pull request closed