From 849d497d3fbb9b742798dcf96e840db81ab3695c Mon Sep 17 00:00:00 2001 From: luiz felipe Date: Mon, 5 Feb 2024 17:23:51 -0300 Subject: [PATCH 1/3] fix: decreasing timer to be able to scroll down the category --- react/Gallery.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/react/Gallery.tsx b/react/Gallery.tsx index b0b7d1757..60e0f756b 100644 --- a/react/Gallery.tsx +++ b/react/Gallery.tsx @@ -1,8 +1,8 @@ import React, { Fragment, useEffect } from 'react' import { ProductList as ProductListStructuredData } from 'vtex.structured-data' -import GalleryLayout from './GalleryLayout' import type { GalleryLayoutProps, Slots } from './GalleryLayout' +import GalleryLayout from './GalleryLayout' import type { GalleryProps as GalleryLegacyProps } from './GalleryLegacy' import GalleryLegacy from './GalleryLegacy' @@ -50,7 +50,7 @@ const Gallery: React.FC< setTimeout(() => { scrollToElement(elementId, offset) - }, 500) + }, 50) } } } @@ -62,7 +62,7 @@ const Gallery: React.FC< } recursiveScroll() - }, 1000) + }, 50) return () => clearTimeout(delayedExecution) }, []) From 2304f6b3c1e6a2bf734d6fd643aad1603962c7cf Mon Sep 17 00:00:00 2001 From: luiz felipe Date: Thu, 8 Feb 2024 14:30:59 -0300 Subject: [PATCH 2/3] fix: prevent loop of recursive function Removing recursive function due to looping on small screens, especially on mobile devices resulting in not being able to scroll down --- manifest.json | 8 +++----- react/Gallery.tsx | 9 ++------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/manifest.json b/manifest.json index 529d9e523..60a9d9d71 100644 --- a/manifest.json +++ b/manifest.json @@ -1,13 +1,11 @@ { "name": "search-result", - "vendor": "vtex", - "version": "3.129.5", + "vendor": "aleatory", + "version": "3.129.6", "title": "VTEX Search Result", "description": "A search result wrapper component", "mustUpdateAt": "2019-04-25", - "registries": [ - "smartcheckout" - ], + "registries": ["smartcheckout"], "scripts": { "postreleasy": "vtex publish --verbose" }, diff --git a/react/Gallery.tsx b/react/Gallery.tsx index 60e0f756b..03d7db4cf 100644 --- a/react/Gallery.tsx +++ b/react/Gallery.tsx @@ -28,10 +28,9 @@ const Gallery: React.FC< useEffect(() => { const lastClickedProductId = localStorage.getItem('lastClickedProductId') - const isMobile = window.innerWidth <= 768 const delayedExecution = setTimeout(() => { - const scrollToElement = (elementId: string, offset: number) => { + const scrollToElement = (elementId: string, _: number) => { const elementToScrollTo = document.getElementById(elementId) if (elementToScrollTo) { @@ -47,17 +46,13 @@ const Gallery: React.FC< block: 'center', inline: 'nearest', }) - - setTimeout(() => { - scrollToElement(elementId, offset) - }, 50) } } } const recursiveScroll = () => { if (lastClickedProductId) { - scrollToElement(lastClickedProductId, isMobile ? -200 : -200) + scrollToElement(lastClickedProductId, -200) } } From 0857f054548db822c6303a128ecf40a3d0a0b103 Mon Sep 17 00:00:00 2001 From: luiz felipe Date: Thu, 8 Feb 2024 14:38:11 -0300 Subject: [PATCH 3/3] chore: updating manifest --- manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 60a9d9d71..523581729 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "search-result", - "vendor": "aleatory", - "version": "3.129.6", + "vendor": "vtex", + "version": "3.129.5", "title": "VTEX Search Result", "description": "A search result wrapper component", "mustUpdateAt": "2019-04-25",