feat(novelties+stock): paginated grid, a11y, error handling — resolves Lovable PRs #547-#552#553
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (14)
WalkthroughPR expande a resiliência da dashboard de estoque com tratamento de erro e carregamento explícito, implementa paginação na grade de novidades com navegação por teclado, adiciona cobertura E2E com sharding de CI, e refatora o wrapper RPC com logging estruturado e fallbacks defensivos. ChangesStock Dashboard Error Handling & Loading States
Novelty Grid Pagination & Keyboard Navigation
E2E Tests & CI Sharding Configuration
RPC Client & External DB Wrapper Improvements
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Suggested labels
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Implements all features from Lovable PRs #547-#552 on a clean base, fixing three critical bugs before merge: BUGS FIXED - Rules of Hooks violation in VariantStockTable: Lovable placed early return BEFORE remaining hook calls; moved isLoading guard after all hooks to comply with React invariant. - Pagination rendered inside AnimatePresence overlay (isFetching branch only): the pagination block was trapped inside the refetch motion.div, making it invisible during normal browsing. Moved outside the relative container entirely. - Ellipsis logic replaced navigable page buttons: Lovable used `page === 2 || page === totalPages - 1` which collapsed pages 2 and penultimate into ellipsis unconditionally. Fixed to use `page === currentPage ± 2` as boundary. FEATURES - NoveltyProductGrid: client-side pagination (20 items/page), page reset on filter/sort change, hides paginator when ≤1 page. - NoveltyCards: ARIA attributes (role, aria-label, aria-selected, tabIndex, onKeyDown) + useCallback for handler stability. - VariantStockTable: inline loading skeleton (isLoading prop) with animate-pulse rows; prop forwarded from StockDashboard. - StockDashboard: error UI with AlertCircle + retry button surfaced from useVariantStock; passes isFetching → isLoading to table. - useVariantStock: exposes `error`; adds retry×3 with exponential backoff (1s→2s→4s capped at 10s). - stockFetcher: throws instead of silently breaking on Supabase error; detects 410/Gone and emits Portuguese user-facing message. - ModernSkeletons: increased title min-height and added price-area skeleton with min-h-[3.25rem] to match card layout. - CI: parallel Playwright shards (2×) in visual-tests.yml; workers=2 in playwright.config.ts. - E2E: novelty-grid-visual.spec.ts expanded to 4 viewports × 5 tests + 3 global tests; novelty-card-variations.spec.ts (new); stock regression spec in tests/e2e/. SKIPPED (already applied in Phase 1/2) - rest-native.ts additions (variant_supplier_sources, supplier_branches, categories) were committed in the Phase 1 kill-switch and Phase 2 ghost-aliases sessions. https://claude.ai/code/session_015DVTnofjTd3PtzU2kGvYtV
PriceFreshnessBadge.tsx: formatExactDateTime → _formatExactDateTime rpc-native.ts: NOT_IN_DB → _NOT_IN_DB (superseded by inline stubs) https://claude.ai/code/session_015DVTnofjTd3PtzU2kGvYtV
…ssBadge Function was never called; removing avoids both unused-vars and naming-convention violations. https://claude.ai/code/session_015DVTnofjTd3PtzU2kGvYtV
6983f98 to
f1116b7
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary
Resolves all features introduced by Lovable PRs #547, #549, #550, #551, #552, applied cleanly on current
mainwith three critical bugs fixed before landing.Critical bugs fixed (not in any Lovable PR)
VariantStockTable.tsxisFetchingoverlayNoveltyProductGrid.tsxmotion.divthat only mounts during refetch — invisible during normal browsingNoveltyProductGrid.tsxpage === 2 || page === totalPages - 1collapsed navigable pages unconditionally; fixed topage === currentPage ± 2Features included
role="article",aria-label,aria-selected,tabIndex,onKeyDown(Enter/Space)isLoadingprop with animate-pulse skeleton rows (hooks-safe placement)isFetching→ table skeletonerror; retry ×3 with exponential backoff (1 s → 2 s → 4 s, cap 10 s)min-h-[3.25rem])visual-tests.yml;workers: 2inplaywright.config.tsnovelty-grid-visual.spec.tsexpanded (4 viewports × 5 tests + 3 global);novelty-card-variations.spec.ts(new);tests/e2e/stock-regression.spec.ts(new)Not included (already applied)
rest-native.tsadditions (variant_supplier_sources,supplier_branches,categories) were committed in Phase 1 (kill-switch) and Phase 2 (ghost aliases) sessions — skipped here to avoid double-application.Test plan
/novidades— scroll through paginated grid, verify page nav shows/hides correctly/novidades— apply filter, confirm page resets to 1/novidades— keyboard Tab to card, Enter/Space to open — verify focus ring and activation/estoque— with kill-switch OFF (current state), verify error UI renders if bridge fails with 410/estoque— verifyisFetchingstate shows skeleton rows in table without Rules of Hooks error in consolenpx playwright test e2e/routes/app/novelty-card-variations.spec.ts— 3 cards rendernpx playwright test e2e/routes/app/novelty-grid-visual.spec.ts— 4 viewports passhttps://claude.ai/code/session_015DVTnofjTd3PtzU2kGvYtV
Generated by Claude Code
Summary by cubic
Adds client-side pagination to the novelties grid with improved a11y, and hardens the stock dashboard with error handling and loading skeletons. Resolves Lovable PRs #547–#552 and fixes three critical issues in pagination and hook usage.
New Features
VariantStockTablesupportsisLoadingwith pulse skeleton rows.useVariantStockexposeserrorand retries x3 with exponential backoff (cap 10s);stockFetcherthrows on Supabase errors and surfaces a 410/Gone message in Portuguese.visual-tests.ymlwithworkers: 2; addednovelty-card-variationsand expandednovelty-grid-visual; newstock-regressionspec.Bug Fixes
VariantStockTable(removed early return between hooks).isFetchingoverlay.PriceFreshnessBadgeunused helper and improvedrpc-nativedispatch with safer fallbacks and clearer errors.Written for commit f1116b7. Summary will update on new commits.
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Style
Tests