From 7e035fd93c5ee076bd3232cb497baffc8bf33527 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 1 Jun 2026 22:23:31 +0000 Subject: [PATCH] perf: deep performance optimizations across catalog, rendering, and build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GPU scroll performance: - Remove backdrop-blur-sm/md and semi-transparent gradients from all scrolling containers (VirtualizedProductGrid, ProductTableView, FiltersPage list/table views) — eliminates per-frame GPU blur on scroll - Add translateZ(0) + will-change:scroll-position to .scrollbar-products React rendering: - Move Intl.NumberFormat, formatPrice, and static lookup tables to module level in ProductCard (no re-creation per render) - Switch full Zustand store subscriptions to fine-grained selectors in ProductCard to prevent all-cards re-render on unrelated store changes - Remove unused useQueryClient hook call in ProductCard - Memoize colGapPx computation in VirtualizedProductGrid - Remove staggered framer-motion animations on virtual rows (triggered on every scroll virtualisation cycle) - Increase overscan: list 8→10, grid 3→5 Filter loop hot-path: - Pre-process all filter arrays to lowercase Sets/Arrays outside the per-product predicate (suppliers, publicoAlvo, datasComemorativas, endomarketing, ramosAtividade, segmentosAtividade, materiais, tags) — eliminates N×M toLowerCase() calls per filter pass - Switch suppliers.includes() O(n) → Set.has() O(1) - Stabilise resize listener with ref pattern (no re-register on column change) Data fetching: - Module-level singleton Promise for category map in useProductsLightweight — prevents N+1 category fetches across paginated loads - Add networkMode: offlineFirst to React Query for cache-first serving - Expand Vite optimizeDeps.include from 5 to 15 packages Build & routing: - Expand RoutePrefetcher with more routes and reduce secondary delay 2500ms → 1800ms - Add dns-prefetch for secondary Supabase host - Tune TooltipProvider delayDuration/skipDelayDuration https://claude.ai/code/session_011LmF185piJUGvBHb4cy5U4 --- index.html | 1 + src/App.tsx | 2 +- src/components/products/ProductCard.tsx | 58 ++++------ src/components/products/ProductTableView.tsx | 2 +- .../products/VirtualizedProductGrid.tsx | 35 +++--- src/hooks/products/useProductsLightweight.ts | 16 ++- src/index.css | 8 ++ src/lib/query-config.ts | 2 + src/pages/filters/useFiltersPageState.ts | 104 +++++++++--------- src/pages/products/FiltersPage.tsx | 4 +- src/routes/RoutePrefetcher.tsx | 19 +++- vite.config.ts | 10 ++ 12 files changed, 136 insertions(+), 125 deletions(-) diff --git a/index.html b/index.html index 107368c0b2..54f2917cda 100644 --- a/index.html +++ b/index.html @@ -48,6 +48,7 @@ +