-
Notifications
You must be signed in to change notification settings - Fork 0
[CRT-212] update create class flow #400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CRT-212] update create class flow #400
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| isDirty | ||
| ? undefined | ||
| : intl.formatMessage(messages.disabledSaveButtonTooltip) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Button Tooltip: Wrong Reason for Disabled State
The tooltip displays "No changes to save" whenever isDirty is false, but the button is also disabled during form submission (isSubmitting) and after successful submission (isSubmitSuccessful). In those cases, the tooltip message is misleading since the button isn't disabled due to lack of changes.
…ion' into feature/CRT-212_UpdateCreateClassFlow
f868ccd
into
feature/CRT-197_ChakraUIIntegration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 issues found across 1 file
Prompt for AI agents (all 2 issues)
Understand the root cause of the following 2 issues and fix them.
<file name="frontend/src/components/class/ClassForm.tsx">
<violation number="1" location="frontend/src/components/class/ClassForm.tsx:106">
Save button still re-enables in create mode because the disable logic only checks `!isDirty` when `showEditedBadges` is true, so after `reset(values)` the button becomes clickable again and users can submit duplicate classes—this violates CRT-212’s “disable when no changes” requirement.</violation>
<violation number="2" location="frontend/src/components/class/ClassForm.tsx:150">
Removing the `<Field.ErrorText>` when self-closing the teacher `<Select>` means `errors.teacherId?.message` is never rendered, so users no longer see why submission fails when the teacher field is missing.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
| > | ||
| <Field.ErrorText>{errors.teacherId?.message}</Field.ErrorText> | ||
| </Select> | ||
| /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the <Field.ErrorText> when self-closing the teacher <Select> means errors.teacherId?.message is never rendered, so users no longer see why submission fails when the teacher field is missing.
Prompt for AI agents
Address the following comment on frontend/src/components/class/ClassForm.tsx at line 150:
<comment>Removing the `<Field.ErrorText>` when self-closing the teacher `<Select>` means `errors.teacherId?.message` is never rendered, so users no longer see why submission fails when the teacher field is missing.</comment>
<file context>
@@ -120,15 +147,21 @@ const ClassForm = ({
- >
- <Field.ErrorText>{errors.teacherId?.message}</Field.ErrorText>
- </Select>
+ />
</Field.Root>
</GridItem>
</file context>
|
|
||
| // Disable the button if in edit mode with no changes, or if the form is submitting or has been successfully submitted | ||
| const isButtonDisabled = | ||
| (showEditedBadges && !isDirty) || isSubmitSuccessful || isSubmitting; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Save button still re-enables in create mode because the disable logic only checks !isDirty when showEditedBadges is true, so after reset(values) the button becomes clickable again and users can submit duplicate classes—this violates CRT-212’s “disable when no changes” requirement.
Prompt for AI agents
Address the following comment on frontend/src/components/class/ClassForm.tsx at line 106:
<comment>Save button still re-enables in create mode because the disable logic only checks `!isDirty` when `showEditedBadges` is true, so after `reset(values)` the button becomes clickable again and users can submit duplicate classes—this violates CRT-212’s “disable when no changes” requirement.</comment>
<file context>
@@ -80,9 +99,17 @@ const ClassForm = ({
+ // Disable the button if in edit mode with no changes, or if the form is submitting or has been successfully submitted
+ const isButtonDisabled =
+ (showEditedBadges && !isDirty) || isSubmitSuccessful || isSubmitting;
+
+ type TeacherOption = {
</file context>
| (showEditedBadges && !isDirty) || isSubmitSuccessful || isSubmitting; | |
| !isDirty || isSubmitSuccessful || isSubmitting; |
Note
Class form now disables the save button when there are no changes or during/after submit, resets dirty state post-success, and shows a tooltip; minor spacing tweak.
frontend/src/components/class/ClassForm.tsx):SubmitFormButtonwhen editing with no changes, while submitting, or after successful submit.Written by Cursor Bugbot for commit d6c5979. This will update automatically on new commits. Configure here.
Summary by cubic
Prevents duplicate class creation by disabling the Save button when there are no changes and during/after submit. Addresses CRT-212 and adds a small UI tweak for clarity.
Written for commit 1215b48. Summary will update automatically on new commits.