<SignIn />: first "Use email" click switches back to phone when `initialValues.phoneNumber` is set

Đang mở Phù hợp với người mới
#10,487 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@twicestruck đang làm issue này rồi.

Từ ngày 28/10/2026.

  • #10488 của @twicestruck — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
74/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
react, typescript
Lĩnh vực
authentication, frontend

Hướng nghiên cứu

Bắt đầu với packages/ui/src/components/SignIn/SignInStart.tsx, đặc biệt là phần khởi tạo textIdentifierField và effect tự động điền được mô tả trong issue. Theo dõi cách nhấp vào “Dùng email” tương tác với handlePhoneNumberPaste; liên kết tái hiện cung cấp cách xác nhận hành vi này. Hoàn tất khi lần nhấp đầu tiên hiển thị trường email có sẵn số điện thoại được điền trước và có kiểm thử hồi quy cho trường hợp đó.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Preliminary Checks
Reproduction

https://github.com/twicestruck/clerk-signin-phone-prefill-repro

Publishable key

pk_test_ZXhwZXJ0LXVuaWNvcm4tNzgyOC5jbGVyay5hY2NvdW50cy5kZXYk

Description

With email and phone both enabled as sign-in identifiers, <SignIn initialValues={{ phoneNumber: '+15555550100' }} /> opens on the phone field as expected, but the first "Use email" click switches straight back to the phone field. The second click works.

Steps to reproduce:

  1. Run the reproduction with the publishable key above
  2. Click "Use email" once

Expected behavior:

The email field shows.

Actual behavior:

The form switches back to the phone field.

Cause: when the form starts on the phone field, SignInStart seeds textIdentifierField with initialValues[identifierAttribute], which is the phone number (source). After the switch, the autofill effect sees a value starting with + and calls handlePhoneNumberPaste, which switches back to the phone field and clears the email field, so the second click sticks. A prefilled number without + shows up in the email field instead.

I'll open a PR with a fix and a test.

Environment
System:
  OS: macOS 27.0.1
  CPU: (18) arm64 Apple M5 Max
  Memory: 157.16 MB / 36.00 GB
  Shell: 5.9 - /bin/zsh
Binaries:
  Node: 24.22.0
  npm: 11.19.1
  pnpm: 12.14.0
  bun: 1.4.3
Browsers:
  Brave Browser: 155.1.97.59
  Chrome: 155.0.8059.85
  Chrome Canary: 158.0.8110.0
  Firefox: 158.0
  Safari: 27.0.1
npmPackages:
  @clerk/react: 6.18.3 => 6.18.3
  @vitejs/plugin-react: 6.1.2 => 6.1.2
  react: 19.3.1 => 19.3.1
  react-dom: 19.3.1 => 19.3.1
  vite: 8.3.5 => 8.3.5
Ngôn ngữ chính
TypeScript
Star
1.8k
Fork
484
Merge trung bình
1 ngày 20 giờ
Pull request đã merge (30 ngày)
363

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của clerk/javascript

Tất cả issue của clerk/javascript

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.