Skip to content

fix(sap): canonical realtime entry + preserve login next + ignore persisted prep mode#267

Merged
Cheewye merged 1 commit intomainfrom
fix/auth-next-and-home
Feb 14, 2026
Merged

fix(sap): canonical realtime entry + preserve login next + ignore persisted prep mode#267
Cheewye merged 1 commit intomainfrom
fix/auth-next-and-home

Conversation

@Cheewye
Copy link
Owner

@Cheewye Cheewye commented Feb 14, 2026

What changed

  • Home route (/) redirects to /map?start=realtime (no forced mode=preparacion).
  • Protected routes redirect unauthenticated users to /login?next=<path+search+hash>.
  • After login, navigation returns to next (only if it starts with /), otherwise falls back to /map?start=realtime (prevents open redirect).
  • Map mode selection now obeys URL precedence:
    • If mode exists in query and is valid -> uses it.
    • If mode is missing -> forces operativo and closes any mode sheet (no restore from persisted state).
    • If mode is invalid -> degrades to operativo, closes sheet, and cleans URL to canonical realtime.
    • Keeps prevision as a valid mode (project uses it).
  • “Preparation loading…” is no longer sticky: auto-hides after ~4s.

Why

  • Avoid surprising default state (Preparation) on canonical realtime entry.
  • Preserve user intent through auth redirect.
  • Improve security by blocking external/open redirects.
  • Prevent sessions getting stuck in a persisted Preparation state.

Files changed (frontend only)

  • frontend/src/App.tsx
  • frontend/src/components/auth/ProtectedRoute.tsx
  • frontend/src/pages/LoginPage.tsx
  • frontend/src/components/maps/realtime/hooks/useMapMode.ts
  • frontend/src/components/maps/realtime/ModeSheetsHost.tsx

Verification

  • npm -C frontend run build ✅ PASS
  • Manual expectations:
    • /map?start=realtime opens in Operational (no auto-Preparation)
    • /map?start=realtime&mode=preparacion enters Preparation; loading hint auto-hides
    • invalid mode cleans to canonical realtime and returns to Operational

Co-authored-by: Cursor <cursoragent@cursor.com>
@Cheewye Cheewye merged commit 445556e into main Feb 14, 2026
11 checks passed
@Cheewye Cheewye deleted the fix/auth-next-and-home branch February 14, 2026 09:55
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