Skip to content

feat: add performance optimization and validation improvements - #75

Merged
Chucks1093 merged 2 commits into
StellarState:devfrom
heymariam:feature/performance-and-validation-improvements
Aug 26, 2026
Merged

feat: add performance optimization and validation improvements#75
Chucks1093 merged 2 commits into
StellarState:devfrom
heymariam:feature/performance-and-validation-improvements

Conversation

@heymariam

Copy link
Copy Markdown
Contributor

Overview

This PR addresses four critical issues with performance optimization, UI/UX improvements, and input validation:

  1. Investor Portfolio Caching - Instant repeat visits with background refresh
  2. Seller Dashboard Skeletons - Better loading state feedback
  3. Marketplace Filter Tests - Comprehensive test coverage for clear button
  4. Invoice Deadline Validation - Enforce 24+ hour minimum deadline

Closes #34
Closes #59
Closes #58
Closes #60

Issues Solved

Issue 1: Stale-While-Revalidate Caching for Investor Portfolio

Acceptance Criteria Met:
✓ Cached portfolio shown instantly on repeat visits within 60 seconds
✓ Background refetch indicator visible during revalidation
✓ Cache invalidated after confirmed investment
✓ Spinner not shown when serving fresh cached response

Files Changed:

  • hooks/usePortfolio.ts - Added cache configuration
  • components/dashboard/InvestorPortfolio.tsx - Added background refresh indicator
  • hooks/useInvestments.ts - Added portfolio cache invalidation on investment
  • components/invoices/InvestDialog.tsx - New investment dialog component
  • components/invoices/InvoiceDetail.tsx - Integrated investment flow

Issue 2: Loading Skeletons for Seller Dashboard

Acceptance Criteria Met:
✓ 4 skeleton rows shown during loading
✓ Skeletons match real row dimensions exactly
✓ All skeletons replaced atomically when data arrives
✓ No skeletons shown when serving cached data

Files Changed:

  • hooks/useSellerDashboard.ts - Added staleTime: 60s cache configuration
  • components/dashboard/SellerDashboard.tsx - Updated skeleton count from 3 to 4

Issue 3: Unit Tests for Marketplace Filter Clear Button

Acceptance Criteria Met:
✓ Status dropdown resets to 'All' on clear
✓ Keyword input cleared on clear
✓ Query re-fired with no filters after clear
✓ Full invoice list restored after clearing

Test Results: 11/11 passing ✓

Files Changed:

  • app/marketplace/__tests__/marketplace-filter-clear.test.tsx - New test file (11 tests)

Issue 4: Funding Deadline Validation (24+ hours minimum)

Acceptance Criteria Met:
✓ Deadline 24h from now passes validation
✓ Deadline under 24h shows correct error message
✓ Past deadline shows error message
✓ Submit button disabled while deadline is invalid

Test Results: 21/21 passing ✓

Files Changed:

  • lib/validation/deadline.ts - New validation utility
  • lib/validation/__tests__/deadline.test.ts - Utility tests (12 tests)
  • components/invoices/__tests__/PublishInvoiceForm.deadline.test.tsx - Form integration tests (9 tests)
  • components/invoices/PublishInvoiceForm.tsx - Integrated validation

Summary

Build & Tests:
✓ TypeScript compilation: 0 errors
✓ All new tests: 32 passing
✓ No breaking changes

Type of Change:

  • New feature (non-breaking change)
  • Bug fix (non-breaking change)

- Add stale-while-revalidate caching to investor portfolio with 60s staleTime
- Show subtle background refresh indicator during revalidation
- Cache invalidate immediately after investment confirmation
- Add loading skeletons to seller dashboard (4 rows matching real dimensions)
- Add unit tests for marketplace filter bar clear button functionality
- Add deadline validation requiring 24+ hours in future for invoice publishing
- Add comprehensive unit tests for all new features with full acceptance criteria coverage
@drips-wave

drips-wave Bot commented Aug 25, 2026

Copy link
Copy Markdown

@heymariam 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

@Chucks1093
Chucks1093 merged commit b21fcb4 into StellarState:dev Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment