Skip to content

fix(auth): header drops the signed-in shell when the session is refused (staging) - #260

Merged
manager merged 1 commit into
devfrom
fix/header-expired-session-staging
Nov 14, 2026
Merged

manager merged 1 commit into
devfrom
fix/header-expired-session-staging

Conversation

@manager

@manager manager commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

A refused sign-in token is wiped by the API layer, but the header kept the skeleton name and the account menu until a reload. The header now listens for the expiry event and returns to the Log In state.

Authorized by Wolf on 2026-11-14.

🤖 Generated with Claude Code

A refused token is wiped by the API layer, but the header kept the
skeleton name and the account menu until a reload. It now listens for
the expiry event and returns to the Log In state.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Claude finished @manager's task in 16s —— View job


Review of #260: header drops signed-in shell on refused session

Verdict: looks good, no blocking issues.

  • The change is small and correct. The three places that fire auth:expired (src/api/strapi.ts:19, src/lib/library/axios/index.ts:39, src/api/auth.ts:21) all remove accessToken from localStorage before dispatching, so the localStorage.getItem('accessToken') guard in syncExpired behaves as intended.
  • The listeners are registered inside an effect and removed in cleanup, so there is no SSR/window access at module level and no leak. The empty dependency array is fine: the handler only calls state setters and reads localStorage.
  • Handling storage as well covers sign-out in another tab. It matches the pattern in AuthContext.tsx:92-100, which clears account data on the same events, so the header and context stay in sync.

Minor, non-blocking

  • The storage handler runs for any key change in any tab. The early return when a token is still present keeps it harmless. Filtering on e.key === 'accessToken' || e.key === null would make the intent clearer, but it is optional.
  • Playwright E2E coverage is not included (the repo's only test layer). I did not run anything, and I did not check this in a browser.
  • The existing useEffect at line 123 now does both initial detection and subscription. That is acceptable, but splitting it would read more cleanly if the file is touched again.

No convention violations found: there is no new state library, no styling change, and no import changes. The change only touches UserProfile.tsx, with no UX Core data involved.

Per CLAUDE.md, this targets dev (staging). The PR body records Wolf's go on 2026-11-14, so I'm treating the merge decision as his.

@manager
manager merged commit d56895d into dev Nov 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant