Keep Xaman login in the current tab - #15
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Xaman sign-in flow to use same-tab navigation (removing CalorieApp-controlled extra tabs and window.open/opener messaging), while preserving the ability to restore the initiating tab’s session using short-lived handoff data stored in sessionStorage. It also removes the now-unused /auth/launching route and updates user-facing notices to clarify the remaining mobile OS/browser return limitation.
Changes:
- Replace the launch-tab + postMessage flow with same-tab navigation to the WordPress/Xaman sign-in URL.
- Persist pending login handoff data in initiating-tab
sessionStorageand attempt restoration when the user returns to that browsing context. - Remove
/auth/launchingand update documentation + UI notices to reflect the new behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Updates documentation to describe same-tab Xaman login and session restoration behavior. |
| frontend/components/XamanLoginPanel.tsx | Implements same-tab login navigation and initiating-tab restoration via sessionStorage. |
| frontend/components/FoodSearchPlaceholder.tsx | Updates phone/browser notice copy to match same-tab login behavior. |
| frontend/app/auth/launching/page.tsx | Removes the no-longer-needed launch/holding page route. |
| frontend/app/auth/complete/page.tsx | Updates completion page messaging for default-browser returns. |
| frontend/app/auth/callback/page.tsx | Updates callback page notices to reflect mobile return behavior and lack of extra tab creation. |
Suppressed comments (1)
frontend/components/XamanLoginPanel.tsx:276
restoreLoginsets up an AbortController and aborts it on cleanup, butrefreshCurrentUserdoes not pass any signal tobackendRequest, so the in-flight/api/identity/merequest cannot be cancelled and can still callsetCurrentUserafter the effect is cancelled/unmounted. That undermines the new cancellation logic and can cause late state updates/races.
Consider wiring loginAbortController.current?.signal into the backendRequest call and skipping state updates when the signal is aborted.
const refreshCurrentUser = useCallback(async (): Promise<MeResponse | null> => {
try {
const response = await backendRequest(
`${BACKEND_BASE_URL}/api/identity/me`
);
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Summary
window.open/ opener messaging./auth/launchingroute.Platform boundary
Xaman documents that iOS and Android do not allow a browser flow to force a return to the exact originating tab. This change removes every extra tab CalorieApp itself controlled; any remaining default-browser return is created by Xaman/the mobile operating system.
Verification
window.open,/auth/launching, opener, or launch-message references remain./auth/launchingroute.release-check.ps1changes.Please do not merge until all checks are green.