refactor: use plain input for totp input to fix autofill issues#790
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughReplaced the multi-slot OTP UI and removed its Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #790 +/- ##
=======================================
Coverage 20.12% 20.12%
=======================================
Files 50 50
Lines 3970 3970
=======================================
Hits 799 799
Misses 3099 3099
Partials 72 72 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@frontend/src/components/auth/totp-form.tsx`:
- Around line 27-32: handleChange currently calls form.handleSubmit(onSubmit) on
every change when value.length === 6, causing repeated submissions; modify
handleChange to only trigger submission when the code just transitioned to 6
digits (not on every onChange) by storing the last-submitted code in a ref
(e.g., lastSubmittedCodeRef) or a boolean (e.g., hasSubmittedRef) and comparing
current value to that before calling form.handleSubmit(onSubmit)(); update
lastSubmittedCodeRef.current = value (or set hasSubmittedRef) after a successful
trigger, and reset the ref when form.setValue changes to a non-6 length so
subsequent edits can submit again; reference functions/variables: handleChange,
form.setValue, form.handleSubmit, onSubmit, and the new
lastSubmittedCodeRef/hasSubmittedRef.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 35356c33-1dd9-46ba-8f1e-74aefff2f1cf
⛔ Files ignored due to path filters (1)
frontend/bun.lockis excluded by!**/*.lock
📒 Files selected for processing (4)
frontend/package.jsonfrontend/src/components/auth/totp-form.tsxfrontend/src/components/ui/input-otp.tsxfrontend/src/pages/totp-page.tsx
💤 Files with no reviewable changes (2)
- frontend/package.json
- frontend/src/components/ui/input-otp.tsx
Fixes #407
Summary by CodeRabbit
Refactor
Style