Skip to content

fix(web): hide signed-out toast for first-time visitors - #2775

Merged
cursor[bot] merged 2 commits into
mainfrom
cursor/fix-anon-signed-out-toast-41a9
Aug 13, 2026
Merged

fix(web): hide signed-out toast for first-time visitors#2775
cursor[bot] merged 2 commits into
mainfrom
cursor/fix-anon-signed-out-toast-41a9

Conversation

@tyler-dane

@tyler-dane tyler-dane commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

First-time visitors (incognito / new users) were immediately seeing You've been signed out. Please sign in again. on staging, next to the Welcome modal.

The API error interceptor treated every 401/410 as session expiry. A brand-new browser can still get those statuses (SuperTokens session refresh on the first API call, or a protected route with no session). That is “not signed in,” not “you were signed out.”

The toast now only appears when this browser has authenticated before (hasUserEverAuthenticated). SuperTokens session wiring listens only to lifecycle onHandleEvents, not postAPIHook payloads that reuse the REFRESH_SESSION name.

Simplicity

Gate stays as two one-line checks at the interceptor and profile catch. No new helpers or modules. SuperTokens apiDomain now uses the origin (BACKEND_BASEURL), matching the backend.

Automated validation

  • Unit: first-time visitor 401 does not call session.signOut or show the toast; returning visitor still does.
  • Profile load: first-time 401 stays quiet; returning visitor still toasts.
  • bun run test:web — pass
  • bun run lint — pass (existing repo warnings only)
  • GitHub CI: lint, type-check, knip, unit (core/web/backend/sync/scripts), e2e, CodeQL — pass

Independent review

Fresh read-only review of the full origin/main diff: no confirmed findings. Logout still clears local auth state; interceptor signOut keeps the flag so a returning expired session still gets the toast.

Test plan

  • bun packages/scripts/src/testing/test-parallel.ts web -- packages/web/src/api/util/api.util.test.ts packages/web/src/auth/compass/user/hooks/useLoadProfile.test.ts
  • bun packages/scripts/src/testing/test-parallel.ts web -- packages/web/src/auth/compass/session/SessionProvider.test.tsx
  • bun run test:web
  • bun run lint
  • GitHub Actions Test + CodeQL on the PR
Open in Web Open in Cursor 

cursoragent and others added 2 commits August 13, 2026 03:14
A 401 on first load is "not signed in", not session expiry. Only announce
sign-out when this browser has authenticated before.

Co-authored-by: Tyler Dane <tyler-dane@users.noreply.github.com>
Co-authored-by: Tyler Dane <tyler-dane@users.noreply.github.com>
@tyler-dane
tyler-dane marked this pull request as ready for review August 13, 2026 03:18
@cursor
cursor Bot merged commit c816f6e into main Aug 13, 2026
20 checks passed
@cursor
cursor Bot deleted the cursor/fix-anon-signed-out-toast-41a9 branch August 13, 2026 03:24
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.

2 participants