From dfd956f23692f5b0a72703e0297dff3fca92de17 Mon Sep 17 00:00:00 2001 From: Rahul Agrawal <12agrawalrahul@gmail.com> Date: Tue, 9 Dec 2025 19:00:01 +0530 Subject: [PATCH] fix: allow same filter multiple times in workspace shortcut (#35133) * fix: populate multiple filters of same type in URL * test: increase wait time for jump to field --- cypress/integration/form.js | 2 +- frappe/public/js/frappe/utils/utils.js | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/cypress/integration/form.js b/cypress/integration/form.js index d83c304c71..c1b8f6126a 100644 --- a/cypress/integration/form.js +++ b/cypress/integration/form.js @@ -3,7 +3,7 @@ const jump_to_field = (field_label) => { .type("{esc}") // lose focus if any .type("{ctrl+j}") // jump to field .type(field_label) - .wait(500) + .wait(1000) .type("{enter}") .wait(200) .findByRole("button", { name: "Go" }) diff --git a/frappe/public/js/frappe/utils/utils.js b/frappe/public/js/frappe/utils/utils.js index 01636c32bc..2facd65c3b 100644 --- a/frappe/public/js/frappe/utils/utils.js +++ b/frappe/public/js/frappe/utils/utils.js @@ -1754,10 +1754,19 @@ Object.assign(frappe.utils, { // don't remove unless patch is created to convert all existing filters from object to array // backward compatibility if (Array.isArray(filters_json)) { - let filter = {}; - filters_json.forEach((arr) => { - filter[arr[1]] = [arr[2], arr[3]]; - }); + let filter = filters_json.reduce((acc, filter) => { + const field = filter[1]; + const value = [filter[2], filter[3]]; + + // if we have multiple filters for the same field, + // we convert it into an array + if (acc[field]) { + acc[field].push(value); + } else { + acc[field] = [value]; + } + return acc; + }, {}); return filter || []; } return filters_json || [];