Skip to content

Error Boundary improvements, useLocalStorage hook, and CourseCard enhancements - #394

Merged
DeFiVC merged 1 commit into
ChainLearnOfficial:mainfrom
Just-Bamford:feature/improvements-error-boundary-hooks-course-card
Aug 29, 2026
Merged

Error Boundary improvements, useLocalStorage hook, and CourseCard enhancements#394
DeFiVC merged 1 commit into
ChainLearnOfficial:mainfrom
Just-Bamford:feature/improvements-error-boundary-hooks-course-card

Conversation

@Just-Bamford

Copy link
Copy Markdown
Contributor

Summary

This PR addresses 4 key improvements to the frontend:

Closes #269
Closes #270
Closes #271
Closes #272

  1. Enhanced ErrorBoundary Component with error reporting, retry logic, and developer tools
  2. useLocalStorage Hook for persistent state management with SSR support
  3. CourseCard Improvements with enrollment status and quick actions

Changes

1. Error Boundary Improvements (src/components/shared/error-boundary.tsx)

  • ✅ Added custom error reporting service interface (easily integrates with Sentry/LogRocket)
  • ✅ Implemented exponential backoff retry logic (1s, 2s, 4s, 8s, 16s with jitter)
  • ✅ Added developer error details toggle showing stack trace and component stack
  • ✅ Retry attempt counter to track failed attempts
  • ✅ Improved error UI with load page option

2. useLocalStorage Hook (src/lib/hooks/use-local-storage.ts)

  • ✅ SSR-safe implementation - no errors on server, syncs on client mount
  • ✅ Automatic JSON serialization/deserialization
  • ✅ Cross-tab synchronization via storage events
  • ✅ Proper cleanup on unmount
  • ✅ Generic type support for any value

3. CourseCard Enhancements (src/components/course/course-card.tsx)

  • ✅ Enrolled status badge (top-left corner)
  • ✅ Progress percentage display with progress bar
  • ✅ Action button that changes based on enrollment (Enroll vs Continue Learning)
  • ✅ Hover overlay with quick action buttons
  • ✅ Added onEnroll and onContinue callbacks

4. Layout Configuration (src/app/layout.tsx)

  • ✅ Enabled error details in development mode
  • ✅ Added error callback for logging

Technical Details

  • All components are fully typed with TypeScript
  • Follows existing project patterns and styling conventions
  • No breaking changes to existing APIs
  • Components are memoized for performance
  • Dark mode support throughout

… card enhancements

- Improve ErrorBoundary with error reporting, exponential backoff retry, and developer error details
- Add useLocalStorage hook for SSR-safe localStorage persistence with cross-tab sync
- Enhance CourseCard with enrollment status, progress display, and quick actions
@netlify

netlify Bot commented Aug 29, 2026

Copy link
Copy Markdown

Deploy Preview for chainlearn failed.

Name Link
🔨 Latest commit a4ad4cb
🔍 Latest deploy log https://app.netlify.com/projects/chainlearn/deploys/6a92b71ffbc94000084b93e5

@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@Just-Bamford Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@DeFiVC
DeFiVC merged commit f1351f5 into ChainLearnOfficial:main Aug 29, 2026
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants