Skip to content
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

Add ErrorBoundary component with tests and LoadingSpinner #115

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Swayam-code
Copy link

@Swayam-code Swayam-code commented Jan 8, 2025

Fixes the issue and Closes #111

Key Benefits of These Changes:

Better Error Handling:

  • Prevents app crashes
  • Shows user-friendly error messages
  • Provides recovery options

Improved User Experience:

  • Individual loading indicators for each operation
  • Clear feedback on what's happening
  • Customizable loading messages

Data Validation:

  • Prevents invalid data from causing issues
  • Clear error messages for validation failures

Testing Infrastructure:

  • Ensures code reliability
  • Catches bugs before production
  • Makes refactoring safer

Copy link

vercel bot commented Jan 8, 2025

@Swayam-code is attempting to deploy a commit to the vansh-codes1's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

github-actions bot commented Jan 8, 2025

Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. In the meantime, please ensure that your changes align with our CONTRIBUTING.md. If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊

@vansh-codes
Copy link
Owner

Please resolve the conficts @Swayam-code

Copy link
Owner

@vansh-codes vansh-codes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolve conflicts and good to merge!

Copy link

vercel bot commented Jan 9, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gityzer ❌ Failed (Inspect) Jan 14, 2025 3:06am

@vansh-codes
Copy link
Owner

image

Error in dependencies, please check and fix the error

@vansh-codes
Copy link
Owner

Hii @Swayam-code , did you fix the error?

@Swayam-code
Copy link
Author

Hii @Swayam-code , did you fix the error?

give me a day. I'm working on it

@vansh-codes
Copy link
Owner

Okay sure @Swayam-code

…t tests

1. Error Boundaries:
- Add ErrorBoundary component with proper error handling and UI
- Implement retry functionality
- Add tests with 100% coverage

2. Loading States:
- Replace global loading state with individual states
- Add separate loading indicators for profile, repos, tagline, and canvas

3. Input Validation:
- Add configValidation utility
- Validate required fields, data types, and value ranges
- Add tests with 95.65% coverage

4. Unit Tests:
- Add tests for ErrorBoundary (100% coverage)
- Add tests for UserCard (96.15% coverage)
- Add tests for config validation (95.65% coverage)
@Swayam-code
Copy link
Author

@vansh-codes
feat: Add error boundaries, loading states, input validation, and unit tests

This PR adds several improvements to enhance error handling, user experience, and code quality:

1. Error Boundaries

  • Add ErrorBoundary component with proper error handling and UI
  • Implement retry functionality
  • Add tests with 100% coverage

2. Loading States

  • Replace global loading state with individual states
  • Add separate loading indicators for:
    • Profile data
    • Repository data
    • Tagline generation
    • Canvas rendering

3. Input Validation

  • Add configValidation utility
  • Validate required fields, data types, and value ranges
  • Add tests with 95.65% coverage

4. Unit Tests

  • Add tests for ErrorBoundary (100% coverage)
  • Add tests for UserCard (96.15% coverage)
  • Add tests for config validation (95.65% coverage)

Changes Made

  • Added new files:
    • src/__tests__/UserCard.test.jsx
    • src/__tests__/configValidation.test.ts
    • src/utils/configValidation.ts
  • Modified existing files:
    • Updated [username]/page.jsx for individual loading states
    • Enhanced ErrorBoundary.jsx with better error handling
    • Updated dependencies in package.json

Test Coverage

  • All tests are passing
  • Overall test coverage improved
  • Key components have high coverage:
    • ErrorBoundary: 100%
    • UserCard: 96.15%
    • Config validation: 95.65%

Build Status

  • Successfully builds with no errors
  • Only minor React Hook optimization warnings remain

@Swayam-code
Copy link
Author

You may also close #116 and #117 as they don't serve any separate purpose.

@vansh-codes
Copy link
Owner

The error still persists buddy! you removed next/babel which is important as per my knowledge

is it working in localhost for you?

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.

Feat: Code Quality Improvements
2 participants