Use the existing session helper instead of fetching /me directly in feature pages
A pull request adds a direct call to /api/me, a new useCurrentUser hook, or a raw token read from localStorage to get the signed-in user. The author argues the repository already has a session helper such as getSession, useAuth, or useSession that the rest of the UI relies on for user, loading, and signed-out states. Ad hoc calls can disagree with the header, handle token expiry differently, or skip the established error handling. The recommended approach is to treat one-off /me fetches in feature pages as a consistency bug and to extend the shared helper when new user fields are needed. Reviewers are advised to search diffs for such patterns and reject parallel session logic.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in