🐛 Fix race condition in recommendation modal when hitting enter#28017
🐛 Fix race condition in recommendation modal when hitting enter#28017AsishKumarDalal wants to merge 1 commit into
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)
WalkthroughThis PR modifies the Enter key behavior for the URL input field in the recommendation modal. When a user presses Enter, the handler now computes a formatted version of the entered URL. If formatting changes the value, it updates the form state and sets an 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
This PR fixes a bug in
add-recommendation-modal.tsxwhere hitting 'Enter' when the URL was already fully formatted would freeze the modal and prevent submission.Changes
useEffectwatching[formState]with an explicit evaluation inonKeyDown.formattedUrlperfectly matchesformState.url, the modal submissiononOk()is triggered synchronously.useEffectreliably triggers submission.