Prevent Xaman launch tab from getting stuck - #13
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the Xaman sign-in launch flow so the temporary launch tab can reliably transition from “Preparing” to the actual Xaman/WordPress sign-in, while also improving user-facing guidance (especially on phones) about the expected browser/tab behavior during the return.
Changes:
- Add retry/backoff logic for starting the login when the backend returns transient 429/502/503/504 responses.
- Switch the launch tab navigation to a same-origin, attempt-bound
postMessagehandshake (instead of directly assigning the external URL from the opener tab). - Add/standardize “phone browser notice” messaging across Xaman-related login surfaces and docs, and add launch-tab status messaging to avoid indefinite “Preparing” UI.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Updates documentation to require phone-user warnings on all Xaman login surfaces. |
| frontend/components/XamanLoginPanel.tsx | Adds start-login retry logic and attempt-bound message-based navigation for the launch tab; updates UX copy and adds a phone notice callout. |
| frontend/components/FoodSearchPlaceholder.tsx | Adds phone browser notice near Xaman sign-in CTA messaging. |
| frontend/app/auth/launching/page.tsx | Implements the launch/holding page listener that waits for an attempt-bound message and navigates securely; adds live status messaging. |
| frontend/app/auth/complete/page.tsx | Adds phone browser notice content to clarify why the return page may open elsewhere. |
| frontend/app/auth/callback/page.tsx | Adds phone browser notice content and adjusts spacing to accommodate the new warning block(s). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| }, [refreshCurrentUser]); | ||
|
|
||
| async function handleLogin() { | ||
| const attemptId = window.crypto.randomUUID(); |
Comment on lines
+32
to
+36
| useEffect(() => { | ||
| const attemptId = new URLSearchParams(window.location.search).get( | ||
| "attempt" | ||
| ); | ||
|
|
Comment on lines
+34
to
+37
| const LOGIN_START_RETRY_WINDOW_MS = 2 * 60_000; | ||
| const LOGIN_START_RETRY_DELAY_MS = 15_000; | ||
| const XAMAN_LAUNCH_MESSAGE_TYPE = "calorieapp-xaman-navigate"; | ||
| const XAMAN_LAUNCH_ERROR_TYPE = "calorieapp-xaman-error"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Verification
release-check.ps1changesDo not merge until all GitHub checks are green.