Skip to content

Conversation

garland3
Copy link
Owner

No description provided.

@Copilot Copilot AI review requested due to automatic review settings September 27, 2025 18:58
Copy link
Contributor

@Copilot Copilot AI left a 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(); } }}
Copy link

Copilot AI Sep 27, 2025

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(); } }}
Copy link

Copilot AI Sep 27, 2025

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(); }}
Copy link

Copilot AI Sep 27, 2025

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.

Suggested change
onClick={(e) => { e.preventDefault(); handleAddClass(); }}
onClick={() => { handleAddClass(); }}

Copilot uses AI. Check for mistakes.

@garland3 garland3 merged commit 76aa1d2 into main Sep 27, 2025
9 of 10 checks passed
@garland3 garland3 deleted the FIX-dynamic-update-classes branch September 27, 2025 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant