Skip to content

Conversation

@ankita10119
Copy link
Contributor

@ankita10119 ankita10119 commented Dec 1, 2025

Changes

Fixes a bug where connectionResolver callback receives the wrong field value when users switch between Login and Sign-up tabs that have different field types (username vs email).

Closes #2631

Root Cause

The bug was in src/ui/box/container.jsx in the checkConnectionResolver() method at line 80:

BEFORE (buggy code)
const userInputValue = c.getFieldValue(lock, 'username') || c.getFieldValue(lock, 'email');
This code always prioritized the username field over email, regardless of which screen (Login vs Sign-up) was currently active. Since both field values exist in the global lock state, it would retrieve the Login username even when on the Sign-up screen.

Solution

Modified checkConnectionResolver() to check which screen is currently active and prioritize the appropriate field:

AFTER (fixed code)

const isSignUpScreen = screenName && screenName.includes('signUp');
const userInputValue = databaseUsernameValue(lock, isSignUpScreen ? { emailFirst: true } : {});

Testing

Manual testing performed -

  • Verified bug exists in original code
  • Applied fix and verified bug is resolved
  • Tested multiple scenarios:
    • Sign-up with email (email prioritized)
    • Sign-up with username only (username used)
    • Login with username (username prioritized)
    • Login with email (email used)
    • Switch from Login to Sign-up with pre-filled fields (correct field used)

Checklist

@ankita10119 ankita10119 requested a review from a team as a code owner December 1, 2025 10:58
@ankita10119
Copy link
Contributor Author

@claude

@github-actions
Copy link

github-actions bot commented Dec 2, 2025

Claude finished @ankita10119's task —— View job


PR Review

  • Gather context and understand PR changes
  • Read project architecture documentation
  • Perform code quality review
  • Perform security review
  • Perform performance review
  • Provide overall assessment

Overall Assessment

❌ This PR addresses the reported bug appropriately, but has test coverage gaps and one code quality concern that should be addressed before merging.

Summary

The fix correctly resolves the issue where connectionResolver receives incorrect field values when switching between Login and Sign-up tabs. The approach of using databaseUsernameValue() with the emailFirst option based on the active screen is sound and leverages existing utility functions properly.

Issues Found:

  • Test Coverage Gap: No tests verify the new screen-based logic works correctly for both 'main.signUp' and 'main.login' screens
  • String Matching Concern: The .includes('signUp') approach could potentially match unintended screen names, though it appears safe given the current codebase patterns

Security & Performance:

  • ✅ No security vulnerabilities introduced
  • ✅ No performance concerns (minimal overhead added)
  • ✅ Proper use of existing APIs and utilities

Recommendations:

  1. Add test cases covering the screen-based field prioritization logic
  2. Consider using exact string matching instead of .includes() for more predictable behavior

@ankita10119 ankita10119 merged commit 5801927 into master Dec 3, 2025
10 checks passed
@ankita10119 ankita10119 deleted the SDK-7230 branch December 3, 2025 08:21
@ankita10119 ankita10119 mentioned this pull request Dec 3, 2025
ankita10119 added a commit that referenced this pull request Dec 3, 2025
**Fixed**

- Fix: connectionResolver receives incorrect field value when switching
between Login and Sign-up tabs
[\#2697](#2697)
([ankita10119](https://github.com/ankita10119))
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.

connectionResolver tests username in wrong tab

3 participants