feat: add performance optimization and validation improvements - #75
Merged
Chucks1093 merged 2 commits intoAug 26, 2026
Conversation
- 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
|
@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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR addresses four critical issues with performance optimization, UI/UX improvements, and input validation:
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 configurationcomponents/dashboard/InvestorPortfolio.tsx- Added background refresh indicatorhooks/useInvestments.ts- Added portfolio cache invalidation on investmentcomponents/invoices/InvestDialog.tsx- New investment dialog componentcomponents/invoices/InvoiceDetail.tsx- Integrated investment flowIssue 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 configurationcomponents/dashboard/SellerDashboard.tsx- Updated skeleton count from 3 to 4Issue 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 utilitylib/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 validationSummary
Build & Tests:
✓ TypeScript compilation: 0 errors
✓ All new tests: 32 passing
✓ No breaking changes
Type of Change: