issue: ending impersonation session #81

Closed
opened 2026-03-20 22:56:18 +00:00 by cpfarhood · 3 comments
cpfarhood commented 2026-03-20 22:56:18 +00:00 (Migrated from github.com)

When ending an impersonation session by pushing end session it does not force the user out of the client view and redirect them back to the admin panel

When ending an impersonation session by pushing end session it does not force the user out of the client view and redirect them back to the admin panel
lint-roller-qa[bot] commented 2026-03-20 23:14:27 +00:00 (Migrated from github.com)

QA Analysis

Confirmed bug. The issue is in CustomerPortal.tsx handleEnd() function (line 67-76):

Problem: After setting session to null (which hides the banner), the staff member is left on the now-read-only customer portal page. There is no redirect back to the admin panel (Clients.tsx).

Expected flow:

  1. Staff clicks "View as Customer" in Clients.tsx admin panel → navigates to portal with sessionId
  2. Staff works in portal
  3. Staff clicks "End Session" → should redirect back to Clients.tsx admin panel

Fix needed: Add or similar redirect after setting session to null in handleEnd.

This appears to be a regression from the frontend wiring PR #78.

## QA Analysis **Confirmed bug.** The issue is in CustomerPortal.tsx handleEnd() function (line 67-76): **Problem**: After setting session to null (which hides the banner), the staff member is left on the now-read-only customer portal page. There is no redirect back to the admin panel (Clients.tsx). **Expected flow**: 1. Staff clicks "View as Customer" in Clients.tsx admin panel → navigates to portal with sessionId 2. Staff works in portal 3. Staff clicks "End Session" → should redirect back to Clients.tsx admin panel **Fix needed**: Add or similar redirect after setting session to null in handleEnd. This appears to be a regression from the frontend wiring PR #78.
the-dogfather-cto[bot] commented 2026-03-20 23:14:46 +00:00 (Migrated from github.com)

CTO Diagnosis

Root cause: CustomerPortal.tsx handleEnd (line 67-76) calls the end API and clears local state (setSession(null)) but never redirects the user back to the admin panel. The user stays on the customer portal with the impersonation UI hidden.

Expected behavior: After ending the session, the user should be redirected to /admin/clients (where they initiated the impersonation from).

Fix: In handleEnd, after clearing state, add window.location.href = '/admin/clients' — consistent with how Clients.tsx uses window.location.href to navigate to the portal when starting a session.

Assigning to @groombook-engineer for implementation.

## CTO Diagnosis **Root cause:** `CustomerPortal.tsx` `handleEnd` (line 67-76) calls the end API and clears local state (`setSession(null)`) but never redirects the user back to the admin panel. The user stays on the customer portal with the impersonation UI hidden. **Expected behavior:** After ending the session, the user should be redirected to `/admin/clients` (where they initiated the impersonation from). **Fix:** In `handleEnd`, after clearing state, add `window.location.href = '/admin/clients'` — consistent with how `Clients.tsx` uses `window.location.href` to navigate to the portal when starting a session. Assigning to @groombook-engineer for implementation.
the-dogfather-cto[bot] commented 2026-03-20 23:30:23 +00:00 (Migrated from github.com)

PR opened: #82

Fix adds window.location.href = "/admin/clients" redirect after ending the impersonation session. Includes unit test. Awaiting QA review.

PR opened: #82 Fix adds `window.location.href = "/admin/clients"` redirect after ending the impersonation session. Includes unit test. Awaiting QA review.
This repo is archived. You cannot comment on issues.
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: groombook/app#81