fix(auth): restore Google sign-in retry state - #1995
groupthinking wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Repository: groupthinking/EventRelay/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Snapshot WarningsEnsure that dependencies are being submitted on PR branches. Re-running this action after a short time may resolve the issue. See the documentation for more information and troubleshooting advice. Scanned FilesNone |
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Restores retry capability for Google sign-in when initiation fails or completes without triggering navigation, while keeping the button disabled during genuine in-flight navigation handoff.
Changes:
- Add in-flight guarding + retryable error state to
GoogleSignInButton. - Display an accessible error message for initiation failures / non-navigation resolutions.
- Add focused jsdom tests covering rejection, resolve-without-navigation, and duplicate-click prevention.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| apps/web/src/app/login/GoogleSignInButton.tsx | Adds ref-based in-flight lock, retry recovery, and alert error UI for failed/non-navigating sign-in initiation. |
| apps/web/src/app/login/GoogleSignInButton.test.tsx | Adds component tests validating retry behavior and duplicate-click prevention across navigation edge cases. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| try { | ||
| await signIn('google', { callbackUrl }); | ||
|
|
||
| if (window.location.href === initialLocation) { | ||
| setError(SIGN_IN_INITIATION_ERROR); | ||
| setIsSubmitting(false); | ||
| signInInFlight.current = false; | ||
| } | ||
| } catch { | ||
| if (window.location.href === initialLocation) { | ||
| setError(SIGN_IN_INITIATION_ERROR); | ||
| setIsSubmitting(false); | ||
| signInInFlight.current = false; | ||
| } |
| {isSubmitting ? 'Redirecting to Google…' : 'Continue with Google'} | ||
| </button> | ||
| {error ? ( | ||
| <p role="alert" className="mt-3 text-sm text-red-300"> |
| vi.mock('next-auth/react', () => ({ signIn: vi.fn() })); | ||
|
|
||
| const callbackUrl = '/studio?video=https://www.youtube.com/watch?v=auJzb1D-fag'; | ||
| const genericError = 'We couldn’t start Google sign-in. Please try again.'; |
| function renderButton() { | ||
| render(<GoogleSignInButton callbackUrl={callbackUrl} />); | ||
| return screen.getByRole('button', { name: 'Continue with Google' }) as HTMLButtonElement; | ||
| } | ||
|
|
||
| function getRetryButton() { | ||
| return screen.getByRole('button', { name: 'Continue with Google' }) as HTMLButtonElement; | ||
| } |
|
AXIOM keep-moving: closing as duplicate/conflicted of GoogleSignInButton retry work. Survivor: #1984 (mergeable). |
Canonical issue
Closes #1987
Outcome
Users can retry Google sign-in after initiation rejects or returns without beginning navigation. The button remains disabled during an actual in-flight handoff, including synchronous duplicate clicks.
Scope
GoogleSignInButton; focusedjsdomcomponent tests for rejected initiation, fulfilled-without-navigation initiation, and navigation-handoff duplicate-click prevention.Risk
81fc601a1ea7a3b5b73d200cd0f30702432d3cf6.Verification
Verified locally on head
81fc601a1ea7a3b5b73d200cd0f30702432d3cf6:npm run test -- src/app/login/GoogleSignInButton.test.tsx src/lib/__tests__/auth-paths.test.ts src/lib/__tests__/auth-config-source.test.ts src/__tests__/proxy-auth-gate.test.ts— 44 passing tests.npm run test— 128 test files passed; 1,213 tests passed; 27 skipped.npm run type-check— exit 0.npm run lint— exit 0 with three existing internal-navigation warnings inOneLoopStudio.tsxandVideoWorkflowStudio.tsx; none originate from this change.npm run build:web— exit 0.npx vitest run tests/e2e/pipeline.test.ts— 17 passing tests against the configured public target; this suite does not cover the Google login button.getByText('$39')now matches four elements; its remaining tests did not exercise/login.Production evidence
Not applicable at PR creation. This is a draft; no deployment, preview creation, merge, or production change was initiated. No protected-preview E2E was run because preview credentials were unavailable in this environment.
Agent handoff