-
Notifications
You must be signed in to change notification settings - Fork 0
fix update class add #33
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
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.
Pull Request Overview
This PR fixes the class management functionality by implementing local loading state and improving form handling. The changes ensure that individual class operations don't affect the global page loading state while maintaining proper user feedback.
- Introduces local
classActionLoading
state to isolate loading indicators for class operations - Converts form from submit-based to button-based with keyboard shortcuts for better UX
- Updates all class operations (add, edit, delete) to use the new local loading state
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
name="class-name" | ||
value={newClass.name} | ||
onChange={(e) => setNewClass({...newClass, name: e.target.value})} | ||
onKeyDown={(e) => { if (e.key === 'Enter') { e.preventDefault(); handleAddClass(); } }} |
Copilot
AI
Sep 27, 2025
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.
The inline event handler should be extracted to a separate function for better readability and reusability. Consider creating a handleKeyDown
function that can be shared between the name and description fields.
Copilot uses AI. Check for mistakes.
rows="2" | ||
value={newClass.description} | ||
onChange={(e) => setNewClass({...newClass, description: e.target.value})} | ||
onKeyDown={(e) => { if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); handleAddClass(); } }} |
Copilot
AI
Sep 27, 2025
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 inline event handler duplicates logic from line 180 with slight variation. Extract both handlers to a shared function that accepts a parameter to handle the shift key condition.
Copilot uses AI. Check for mistakes.
className="btn btn-primary" | ||
disabled={loading} | ||
disabled={classActionLoading} | ||
onClick={(e) => { e.preventDefault(); handleAddClass(); }} |
Copilot
AI
Sep 27, 2025
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.
The e.preventDefault()
call is unnecessary here since this is a button with type=\"button\"
and not inside a form context that would cause default submission behavior.
onClick={(e) => { e.preventDefault(); handleAddClass(); }} | |
onClick={() => { handleAddClass(); }} |
Copilot uses AI. Check for mistakes.
No description provided.