From ce58874cb4c4d80ecedd60b457469a9d4768b82c Mon Sep 17 00:00:00 2001 From: Pawan Kumar Date: Tue, 3 Jun 2025 13:10:17 +0530 Subject: [PATCH] chore: fix resetting of Dropdown control of UQI (#40775) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before the options of dropdown control could load up, the dropdown control was hitting `onChange` which was resetting the options for that control. This PR adds a check to look for selectionOptions before resetting the options. /ok-to-test tags="@tag.Sanity" ## Summary by CodeRabbit ## Summary by CodeRabbit - **Bug Fixes** - Improved the behavior of multi-select dropdowns to ensure selected values are only re-synced when valid options are present, preventing unnecessary updates. > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: caa978dc326fe017c06c7ceafe64f6f1890814fe > Cypress dashboard. > Tags: `@tag.Sanity` > Spec: >
Thu, 29 May 2025 09:01:42 UTC --- app/client/src/components/formControls/DropDownControl.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/client/src/components/formControls/DropDownControl.tsx b/app/client/src/components/formControls/DropDownControl.tsx index 328f3f70b7..6bacc50b81 100644 --- a/app/client/src/components/formControls/DropDownControl.tsx +++ b/app/client/src/components/formControls/DropDownControl.tsx @@ -334,7 +334,11 @@ function renderDropdown( }); // Re-sync multi-select if stale - if (isMultiSelect && Array.isArray(selectedValue)) { + if ( + isMultiSelect && + Array.isArray(selectedValue) && + selectedOptions.length > 0 + ) { const validValues = selectedOptions.map((so) => so.value); if (