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.
feat(catalog): hover image — main → set crossfade no card de produto #598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
feat(catalog): hover image — main → set crossfade no card de produto #598
Changes from all commits
332e7e8File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new crossfade component is not imported by the catalog card path:
src/components/products/ProductCard.tsximports./ProductCardImage, which resolves tosrc/components/products/ProductCardImage.tsx, and repo search only finds thissrc/components/catalog/ProductCardImage.tsxreferenced inside its own file. As a result, products withset_image_urlstill render through the existingOptimizedImagecomponent and never show the hover crossfade; please move this behavior into the rendered product card image component or update the import path.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug crítico: loop infinito se placeholder falhar.
O
onErrorna linha 107 setasrcpara'/placeholder.svg', mas se o próprio placeholder falhar (arquivo faltando, erro de rede, CORS), disparaonErrorde novo → loop infinito. Browser pode travar ou consumir memória descontroladamente.Solução: adicionar guard para evitar trocar novamente se já estiver no placeholder.
🛡️ Fix proposto para prevenir loop
onError={(e) => { - (e.currentTarget as HTMLImageElement).src = '/placeholder.svg'; + const img = e.currentTarget as HTMLImageElement; + if (img.src !== '/placeholder.svg' && !img.src.endsWith('/placeholder.svg')) { + img.src = '/placeholder.svg'; + } }}📝 Committable suggestion
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: adm01-debug/promo-gifts-v4
Length of output: 2729
🏁 Script executed:
Repository: adm01-debug/promo-gifts-v4
Length of output: 25046
🏁 Script executed:
Repository: adm01-debug/promo-gifts-v4
Length of output: 4672
🏁 Script executed:
Repository: adm01-debug/promo-gifts-v4
Length of output: 12321
Memoize categorias no useProductsCatalog (evita N chamadas de rede ao scroll)
loadCategoriesMapchamafetchPromobrindCategoriese monta um novoMap; comofetchCatalogPageexecuta isso dentro doqueryFn, cada página carregada nouseInfiniteQuerydispara novamente a busca das categorias.Além disso,
fetchPromobrindCategoriesnão faz early-return doimmutableCache: ele sempre rodadbInvokeemcategoriese só depois preencheputInCacheSafe('categories', ...), então o cache atual não evita essas chamadas.Sugerido: memoizar a promessa/lista de categorias (ex.: ref escopo do hook ou cache de módulo com TTL) e reutilizar o
categoriesByIdnas páginas; ou reaproveitaruseCategories/React Query (mesmostaleTime: 30 min) e passar o mapa paramapLightweightToProduct.🤖 Prompt for AI Agents
Uh oh!
There was an error while loading. Please reload this page.