You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The compare form should prevent users from comparing the same GitHub username against itself and should avoid submitting the same completed comparison again after the data has already been fetched. This would reduce unnecessary API calls and make the form validation clearer.
Context
components/compare-form.tsx currently enables submit when both username fields are non-empty and the page is not loading.
The submit handler trims values, but it does not compare username1 and username2 case-insensitively before calling onSubmit.
components/home-page-client.tsx tracks lastFetchedKeyRef, inFlightFetchKeyRef, data, and displayData, but the submit button remains enabled after a successful fetch for the same usernames and selected languages.
GitHub usernames should be treated case-insensitively for validation, so Octocat and octocat should count as the same username.
Tasks
Add client-side validation that blocks submission when both username fields normalize to the same value.
Show a localized field or form error explaining that two different GitHub usernames are required.
Disable the compare button when the current form values and selected languages match the already-fetched comparison.
Re-enable submission when either username or selected languages change.
Keep protection in handleCompare so repeated submissions cannot trigger duplicate /api/compare requests even if the button state is bypassed.
Add tests for same-username validation and already-fetched comparison submit prevention.
Tip
🚀 Want to contribute?
Comment assign me to be automatically assigned to this issue via our GitHub Actions bot. Happy coding! ✨
The compare form should prevent users from comparing the same GitHub username against itself and should avoid submitting the same completed comparison again after the data has already been fetched. This would reduce unnecessary API calls and make the form validation clearer.
Context
components/compare-form.tsxcurrently enables submit when both username fields are non-empty and the page is not loading.username1andusername2case-insensitively before callingonSubmit.components/home-page-client.tsxtrackslastFetchedKeyRef,inFlightFetchKeyRef,data, anddisplayData, but the submit button remains enabled after a successful fetch for the same usernames and selected languages.Octocatandoctocatshould count as the same username.Tasks
handleCompareso repeated submissions cannot trigger duplicate/api/comparerequests even if the button state is bypassed.Tip
🚀 Want to contribute?
Comment
assign meto be automatically assigned to this issue via our GitHub Actions bot. Happy coding! ✨