The PR needs the current user and adds fetch('/api/me'), a new useCurrentUser hook, or a raw localStorage.getItem('token') read in the page. The repo already has a session helper (getSession, useAuth, or useSession) that the rest of the UI uses for the signed-in user, loading, and signed-out states. The new call looks fine in isolation and then disagrees with the header, expires the token differently, or skips the existing error path.
I've started treating a one-off /me fetch in a feature page as a consistency bug, not as a quicker read. The helper is there so every screen does not invent its own idea of "who is signed in." This article was written with the assistance of AI.
Why the homemade session read shows up
Auth tutorials start with fetch('/me') or a token in localStorage. The model can write that without finding useAuth. Your helper may live under lib/auth or a provider folder, which is easy to miss if the prompt only says "show the current user's name."
This is narrower than adding a second auth library. The session wrapper already exists, and the page bypasses it.
A simple session policy
- New reads of the current user use the existing session helper
- Do not call
/me, decode a JWT, or read the token from storage in a feature component - A new field (email, role, workspace) is a helper change, with an example
- Keep signed-out and loading states on the helper, not ad-hoc in the page
If the page needs a permission the helper already exposes, use that flag. Do not re-derive "is admin" from a raw user payload in the view.
What to put in the prompt
Use the existing session helper (getSession, useAuth, or useSession) for the current user. Do not fetch /me, decode a JWT, or read the token from storage in this page. If you need a field the helper does not expose, add it to the helper; do not invent a second hook. Keep the loading and signed-out paths the helper already provides. Paste the helper's exports or one existing usage. In review, search the diff for /me, /api/auth, localStorage token reads, jwt, and a new useCurrentUser or getUser that is not the shared helper.
Reject / send back
Reject
- A feature page that fetches the current user or reads the token itself
- A second session hook added next to the existing one
- A view that decodes a JWT or re-derives a role inline
- Mixed signed-out behavior between the header and the new page
Accept
- A page that reads the user through the existing session helper
- A helper PR that adds a documented field or flag
- A bugfix that replaces a one-off
/mefetch with the helper