Lovable sync 1780254455#550
Conversation
X-Lovable-Edit-ID: edt-2861a40d-d258-4d19-aa54-31352a773f86 Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
X-Lovable-Edit-ID: edt-dcfc3e5b-15a6-4368-9747-c1e2a3a946b2 Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
X-Lovable-Edit-ID: edt-a613bb01-3be5-4e73-afb3-e58acf636175 Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
X-Lovable-Edit-ID: edt-6fa19df9-0496-4719-b1c5-a88eab685b36 Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
X-Lovable-Edit-ID: edt-70a1ae4f-e6ec-41f0-873e-f30970596f1d Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
X-Lovable-Edit-ID: edt-f6465b77-0411-4059-9764-f972bb93fbed Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
|
Warning Review limit reached
More reviews will be available in 36 minutes and 22 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (15)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
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. |
There was a problem hiding this comment.
Pull request overview
This PR adds a virtualized/paginated Novidades grid, improves stock-dashboard error handling, and expands Playwright visual/a11y coverage for the Novidades UI and stock regression paths.
Changes:
- Adds a virtualized Novidades grid, pagination state, refreshed header styling, and keyboard handlers for novelty cards.
- Surfaces stock-fetch errors in the dashboard and changes stock bridge failures to throw user-facing errors.
- Adds/updates Playwright visual/a11y/regression specs and shards the visual-test workflow.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
src/components/novelties/NoveltyProductGrid.tsx |
Adds pagination and switches grid rendering to the virtualized grid. |
src/components/novelties/VirtualizedNoveltyGrid.tsx |
Introduces virtualized row rendering for novelty cards. |
src/components/novelties/NoveltyCards.tsx |
Adds keyboard activation and ARIA metadata to novelty grid cards. |
src/pages/products/NoveltiesPage.tsx |
Updates Novidades page header layout and test ids. |
src/components/loading/ModernSkeletons.tsx |
Adjusts product-card skeleton sizing to reduce layout shift. |
src/hooks/products/useVariantStock.ts |
Exposes React Query errors and limits retry attempts. |
src/hooks/stock/stockFetcher.ts |
Throws clearer stock-fetch errors, including 410/Gone handling. |
src/components/inventory/StockDashboard.tsx |
Adds an error state with retry UI. |
src/lib/external-db/rest-native.ts |
Extends REST-native safe table whitelist. |
src/pages/auth/Auth.tsx |
Removes Supabase connection debug UI from Auth. |
playwright.config.ts |
Increases CI Playwright workers from 1 to 2. |
.github/workflows/visual-tests.yml |
Shards visual tests and includes new Novidades visual specs. |
e2e/routes/app/novelty-grid-visual.spec.ts |
Adds Novidades visual, accessibility, skeleton, and pagination checks. |
e2e/routes/app/novelty-card-variations.spec.ts |
Adds visual checks for novelty card edge cases. |
tests/e2e/stock-regression.spec.ts |
Adds stock dashboard regression coverage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| {totalPages > 1 && ( | ||
| <div className="mt-6 flex justify-center py-4"> | ||
| <Pagination> | ||
| <PaginationContent> |
| onClick={handleClick} | ||
| role="article" | ||
| aria-label={`${product.product_name} — ${getStockStatusLabel(stockStatus)}, ${formatPrice(product.base_price ?? 0)}`} | ||
| aria-selected={selectionMode ? isSelected : undefined} | ||
| tabIndex={0} |
| import { test, expect } from '@playwright/test'; | ||
|
|
||
| test.describe('Estoque Dashboard E2E', () => { |
| await page.route('**/api/external-db', async route => { | ||
| if (route.request().postDataJSON()?.operation === 'select') { | ||
| await new Promise(resolve => setTimeout(resolve, 2000)); | ||
| } | ||
| await route.continue(); |
| await context.route('**/functions/v1/novelties**', async route => { | ||
| await route.fulfill({ | ||
| status: 200, | ||
| contentType: 'application/json', | ||
| body: JSON.stringify([ |
| const header = page.locator('div.flex.flex-col.gap-4').first(); | ||
| const title = header.locator('[data-testid="page-title-novidades"]'); | ||
| const desc = header.locator('[data-testid="novelty-description"]'); |
| // Check for loading state first (if it appears) | ||
| const loadingState = page.locator('text=Sincronizando estoque'); | ||
| if (await loadingState.isVisible()) { | ||
| // Wait for loading to finish | ||
| await expect(loadingState).not.toBeVisible({ timeout: 30000 }); |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: abc7d108f1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| </div> | ||
| </div> | ||
|
|
||
| {totalPages > 1 && ( |
There was a problem hiding this comment.
Render pagination outside the fetching overlay
With more than 20 novelties, renderContent() now always passes only paginatedProducts to the grid, but these controls are nested inside the isFetching && products.length > 0 overlay above. After the initial load settles (isFetching is false), the grid remains capped to page 1 and users have no visible way to reach the remaining products; during refetch the controls also sit inside a pointer-events-none overlay, so they cannot be used then either.
Useful? React with 👍 / 👎.
| onKeyDown={(e) => { | ||
| if (e.key === 'Enter' || e.key === ' ') { | ||
| e.preventDefault(); | ||
| handleClick(); | ||
| } |
There was a problem hiding this comment.
Stop card key handling from double-toggling the checkbox
When selection mode is active and a keyboard user focuses the SelectionCheckbox, pressing Space/Enter bubbles the keydown to this card handler, which toggles selection, and then the button's own click handler toggles it again. This makes the checkbox effectively unusable from the keyboard in the grid; the card-level handler should ignore events originating from nested controls or the checkbox should stop key propagation.
Useful? React with 👍 / 👎.
| @@ -0,0 +1,49 @@ | |||
| import { test, expect } from '@playwright/test'; | |||
There was a problem hiding this comment.
Move the stock regression spec under the configured testDir
This new Playwright regression spec is placed in tests/e2e, but I checked playwright.config.ts and the configured testDir is ./e2e, with project testMatch patterns scoped under that directory. As a result, normal npx playwright test/CI discovery will not run this regression test, so the intended stock-dashboard coverage is currently absent unless someone invokes the file path manually.
Useful? React with 👍 / 👎.
|
|
||
| test('Pagination & Alignment Check', async ({ page }) => { | ||
| // Mock enough products for multiple pages | ||
| await page.route('**/api/external-db', async route => { |
There was a problem hiding this comment.
Mock the endpoint the novelties page actually calls
These pagination/variation tests depend on mocked novelty data, but the novelties hook reads the products table through invokeExternalDb/REST-native Supabase calls, not an **/api/external-db endpoint. In CI or local runs this route therefore will not intercept the page's data fetch, so the tests exercise whatever real/fallback data is returned and assertions such as waiting for a paginator with 45 mocked products will fail or become non-deterministic.
Useful? React with 👍 / 👎.
| ); | ||
| } | ||
|
|
||
| if (error) { |
There was a problem hiding this comment.
Preserve cached stock data on refresh errors
After the dashboard has successfully loaded, a later manual refresh or invalidation can fail while React Query still has the previous stock data cached. This unconditional error branch replaces the entire dashboard with the failure card in that scenario, hiding otherwise usable stale stock data; gate the full-page error on the absence of data or use the query's error status so refetch failures can be surfaced without blanking the dashboard.
Useful? React with 👍 / 👎.
|
Closing in favour of #553, which implements all features from this PR (and from #547, #549, #551, #552) on current
This branch also had merge conflicts with main due to the older base SHA. Generated by Claude Code |
📋 Descrição
🎯 Tipo de mudança
🔗 Issues relacionadas
Closes #
Refs #
🌐 Sistemas afetados
🧪 Como testar
✅ Checklist pré-merge
Qualidade
npx tsc --noEmitpassa sem errosnpm run test)Segurança
console.logcom payloads sensíveis (usarlogger.*)Documentação
mem://) se a mudança afetar arquitetura/regras_backup_*_YYYYMMDDse destrutivasUI
📸 Screenshots (se UI)
🔄 Plano de rollback
Summary by cubic
Introduces a virtualized Novidades grid with pagination and better accessibility, plus broader visual/a11y test coverage. Improves performance, avoids layout shifts, and adds robust error handling to prevent stock dashboard white screens.
New Features
useVariantStocknow exposeserror; added REST-native table whitelisting.Bug Fixes
Written for commit abc7d10. Summary will update on new commits.