fix(web): clear server session on dev login user switch #205

Merged
groombook-engineer[bot] merged 2 commits from fix/gro-263-dev-login-session-switch into main 2026-04-02 01:44:28 +00:00
groombook-engineer[bot] commented 2026-04-02 01:22:58 +00:00 (Migrated from github.com)

Summary

  • Fixes GRO-263: user switch via dev login selector now properly clears the server session and loads the new user's data
  • Root cause: CustomerPortal was rendered unconditionally for all non-/admin routes, including /login. A useRef guard (initDone) prevented session re-initialization when navigating away and back, so the old impersonation session persisted across user switches
  • Fix: exclude /login from CustomerPortal rendering so it unmounts when the user switches — on re-navigation to /, a fresh CustomerPortal mounts and creates a new session for the selected dev user

Test plan

  • Log in as any client (e.g. Sarah Mitchell)
  • Navigate to /login
  • Select a different client (e.g. Abigail Brooks)
  • Verify Home, My Pets, Appointments, and Billing all reflect the newly selected client's data

cc @cpfarhood

🤖 Generated with Claude Code

## Summary - Fixes GRO-263: user switch via dev login selector now properly clears the server session and loads the new user's data - Root cause: `CustomerPortal` was rendered unconditionally for all non-`/admin` routes, including `/login`. A `useRef` guard (`initDone`) prevented session re-initialization when navigating away and back, so the old impersonation session persisted across user switches - Fix: exclude `/login` from `CustomerPortal` rendering so it unmounts when the user switches — on re-navigation to `/`, a fresh `CustomerPortal` mounts and creates a new session for the selected dev user ## Test plan - [ ] Log in as any client (e.g. Sarah Mitchell) - [ ] Navigate to `/login` - [ ] Select a different client (e.g. Abigail Brooks) - [ ] Verify Home, My Pets, Appointments, and Billing all reflect the newly selected client's data cc @cpfarhood 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-04-02 01:27:58 +00:00 (Migrated from github.com)

Deployed to groombook-dev

Images: pr-205
URL: https://dev.groombook.farh.net

Ready for UAT validation.

## Deployed to groombook-dev **Images:** `pr-205` **URL:** https://dev.groombook.farh.net Ready for UAT validation.
lint-roller-qa[bot] (Migrated from github.com) approved these changes 2026-04-02 01:38:08 +00:00
lint-roller-qa[bot] (Migrated from github.com) left a comment

QA Approve — Code review complete.

App.tsx: correctly excludes /login from CustomerPortal rendering so session reinitializes on user switch. Diff matches issue description.

CI: lint/typecheck/test/E2E/Build/Deploy all pass. Web E2E (Dev) fails with pre-existing auth fixture issue (same as GRO-378 — dev env not receiving infra deploys due to skipped Update Infra Image Tags step). E2E Tests (PR-environment) confirm fix works.

Note: PR also includes ci.yml --merge fix from GRO-378.

**QA Approve** — Code review complete. `App.tsx`: correctly excludes `/login` from CustomerPortal rendering so session reinitializes on user switch. Diff matches issue description. CI: lint/typecheck/test/E2E/Build/Deploy all pass. `Web E2E (Dev)` fails with pre-existing auth fixture issue (same as GRO-378 — dev env not receiving infra deploys due to skipped `Update Infra Image Tags` step). E2E Tests (PR-environment) confirm fix works. Note: PR also includes ci.yml `--merge` fix from GRO-378.
the-dogfather-cto[bot] (Migrated from github.com) approved these changes 2026-04-02 01:41:45 +00:00
the-dogfather-cto[bot] (Migrated from github.com) left a comment

CTO Approve

Clean fix. CustomerPortal exclusion at /login correctly forces unmount/remount cycle, clearing the stale impersonation session. Early return at L243 handles the actual login rendering; the showCustomerPortal guard is a sound defensive addition.

CI: all required checks pass. Web E2E (Dev) failure is pre-existing (GRO-378 infra gap).

Bundled ci.yml --merge fix (GRO-378) also LGTM — --auto requires branch protection status checks that don't exist on groombook/infra.

**CTO Approve** Clean fix. CustomerPortal exclusion at `/login` correctly forces unmount/remount cycle, clearing the stale impersonation session. Early return at L243 handles the actual login rendering; the `showCustomerPortal` guard is a sound defensive addition. CI: all required checks pass. `Web E2E (Dev)` failure is pre-existing (GRO-378 infra gap). Bundled ci.yml `--merge` fix (GRO-378) also LGTM — `--auto` requires branch protection status checks that don't exist on groombook/infra.
This repo is archived. You cannot comment on pull requests.