fix: keep invite signup interactive after existing account warning#28855
fix: keep invite signup interactive after existing account warning#28855Monti-27 wants to merge 1 commit intocalcom:mainfrom
Conversation
📝 WalkthroughWalkthroughAdds a test file for the signup submit error flow when a user already exists, with extensive mocks for signup, routing, authentication, and notifications. Modifies the signup view component to remove the 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/web/modules/signup-view.submit.test.tsx (1)
157-157: Prefer fake timers over real 3.1s delay in tests.Line 157’s real sleep can slow and occasionally destabilize CI. Consider
vi.useFakeTimers()and advancing time to assert the redirect deterministically.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/web/modules/signup-view.submit.test.tsx` at line 157, Replace the real 3.1s sleep in the test (the await new Promise(resolve => setTimeout(resolve, 3100)) call in apps/web/modules/signup-view.submit.test.tsx) with fake timers: call vi.useFakeTimers() at the start of the test, trigger whatever action causes the setTimeout-based redirect, advance timers deterministically using vi.advanceTimersByTime(3100) or vi.runAllTimers(), then await any pending microtasks/promises (e.g., await Promise.resolve() or use vi.runAllTimersAsync()) to let the redirect promise settle, and finally call vi.useRealTimers() to restore; this removes the real delay while preserving the same assertion behavior for the redirect.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@apps/web/modules/signup-view.submit.test.tsx`:
- Line 157: Replace the real 3.1s sleep in the test (the await new
Promise(resolve => setTimeout(resolve, 3100)) call in
apps/web/modules/signup-view.submit.test.tsx) with fake timers: call
vi.useFakeTimers() at the start of the test, trigger whatever action causes the
setTimeout-based redirect, advance timers deterministically using
vi.advanceTimersByTime(3100) or vi.runAllTimers(), then await any pending
microtasks/promises (e.g., await Promise.resolve() or use
vi.runAllTimersAsync()) to let the redirect promise settle, and finally call
vi.useRealTimers() to restore; this removes the real delay while preserving the
same assertion behavior for the redirect.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 61732cb6-f1e2-4dba-bb39-e67194f02def
📒 Files selected for processing (2)
apps/web/modules/signup-view.submit.test.tsxapps/web/modules/signup-view.tsx
Fixes #28854
Summary
This keeps the invite signup form usable after the existing account warning.
The warning path was still leaving the form in a successful state, so the submit button stayed disabled until the redirect. This change only keeps the button loading while the request is actually in flight, and adds a regression test for that flow.
Testing
TZ=UTC yarn test apps/web/modules/signup-view.submit.test.tsxpackages/trpcandpackages/app-store