From 711f37bce1b2e4455e127d4eaf7f81b8681c45b9 Mon Sep 17 00:00:00 2001 From: Ahmed Ejaz Date: Wed, 27 Nov 2024 17:49:21 +0500 Subject: [PATCH] 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 --- app/webpacker/controllers/search_controller.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/webpacker/controllers/search_controller.js b/app/webpacker/controllers/search_controller.js index 49ee75a7b52..dd34b33a353 100644 --- a/app/webpacker/controllers/search_controller.js +++ b/app/webpacker/controllers/search_controller.js @@ -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;