Scroll product details to top on navigation
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 51s

This commit is contained in:
Cauê Faleiros
2026-08-03 11:36:24 -03:00
parent 60ded40595
commit fb8b827c73

View File

@@ -143,6 +143,15 @@ const ProductDetails = () => {
const [variantCurrentPage, setVariantCurrentPage] = useState(1); const [variantCurrentPage, setVariantCurrentPage] = useState(1);
const [variantItemsPerPage, setVariantItemsPerPage] = useState(5); const [variantItemsPerPage, setVariantItemsPerPage] = useState(5);
useEffect(() => {
const scrollContainer = document.querySelector<HTMLElement>('.app-content');
if (scrollContainer) {
scrollContainer.scrollTo({ top: 0, behavior: 'auto' });
} else {
window.scrollTo({ top: 0, behavior: 'auto' });
}
}, [id]);
useEffect(() => { useEffect(() => {
let isMounted = true; let isMounted = true;