chore: fix resetting of Dropdown control of UQI (#40775)

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"

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## 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.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/15319483195>
> Commit: caa978dc326fe017c06c7ceafe64f6f1890814fe
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=15319483195&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Sanity`
> Spec:
> <hr>Thu, 29 May 2025 09:01:42 UTC
<!-- end of auto-generated comment: Cypress test results  -->
This commit is contained in:
Pawan Kumar 2025-06-03 13:10:17 +05:30 committed by GitHub
parent c5cc619721
commit ce58874cb4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 (