Copilot commented on code in PR #11591:
URL: https://github.com/apache/cloudstack/pull/11591#discussion_r2336101658


##########
ui/src/components/widgets/InfiniteScrollSelect.vue:
##########
@@ -239,6 +256,7 @@ export default {
     },
     addDefaultOptionIfNeeded () {
       if (this.defaultOption) {
+        this.canSelectFirstOption = true

Review Comment:
   Setting `canSelectFirstOption = true` in `addDefaultOptionIfNeeded()` 
interferes with the auto-selection logic. This prevents the first fetched 
option from being auto-selected when `autoSelectFirstOption` is true, since the 
flag gets set prematurely.
   ```suggestion
   
   ```



##########
ui/src/components/widgets/InfiniteScrollSelect.vue:
##########
@@ -218,6 +229,12 @@ export default {
         (Array.isArray(this.preselectedOptionValue) && 
this.preselectedOptionValue.length === 0) ||
         this.successiveFetches >= this.maxSuccessiveFetches) {
         this.resetPreselectedOptionValue()
+        if (!this.canSelectFirstOption && this.autoSelectFirstOption && 
this.options.length > 0) {

Review Comment:
   The condition `!this.canSelectFirstOption` prevents auto-selection from 
working correctly. Since `canSelectFirstOption` is set to `true` after 
fetching, this condition will always be false when options are available, 
breaking the auto-select functionality.
   ```suggestion
           if (this.autoSelectFirstOption && this.options.length > 0) {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to