Skip to content

feat: add validation, delete confirmation, and loading states to Library#12

Open
codeCraft-Ritik wants to merge 1 commit into
Volunteer-Tech:mainfrom
codeCraft-Ritik:main
Open

feat: add validation, delete confirmation, and loading states to Library#12
codeCraft-Ritik wants to merge 1 commit into
Volunteer-Tech:mainfrom
codeCraft-Ritik:main

Conversation

@codeCraft-Ritik

Copy link
Copy Markdown

To provide a professional contribution to the repository, you should include a clear and structured description of your changes. This is typically used in the Pull Request (PR) description or the Git commit message.

Pull Request Title
feat: improve library management with validation, safety, and loading states

Pull Request Description
Overview This PR enhances the Library management module by improving the user experience, fixing state management bugs, and adding safety checks to prevent accidental data loss.

Changes Implemented

Client-Side Search Validation: Added logic to the handleSubmit function to trim whitespace and prevent empty search queries from being sent to the API.

Delete Confirmation Dialog: Implemented a standard window.confirm browser dialog in the handleDelete function to ensure users verify a deletion before the record is removed from the database.

Loading State Indicators: Integrated a React-Bootstrap Spinner component that displays while book data is being fetched, providing visual feedback to the user during asynchronous operations.

State Management Bug Fix: Replaced the direct state mutation of the books array (previously using _.remove) with a functional .filter() approach to ensure React correctly detects state changes and re-renders the UI.

UI/UX Enhancements: Added cursor: pointer styles to interactive elements like column headers and the trash icon to improve discoverability and accessibility.

Error Handling: Added try...catch blocks around asynchronous fetch requests to handle API failures gracefully and log them to the console.

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