13002: fix the search-controller error

- productForm is not accessible on the orders page
- putting the check to do the scrollIntoView only if the productForm is available
This commit is contained in:
Ahmed Ejaz
2024-11-27 17:49:21 +05:00
parent a493d70f5c
commit 711f37bce1

View File

@@ -10,7 +10,8 @@ export default class extends Controller {
changePage(event) {
const productsForm = document.querySelector("#products-form");
productsForm.scrollIntoView({ behavior: "smooth" });
if (productsForm) productsForm.scrollIntoView({ behavior: "smooth" });
this.page.value = event.target.dataset.page;
this.submitSearch();
this.page.value = 1;