Skip to content

Commit

Permalink
Fix filled calculation regarding null or undefined values (#16421)
Browse files Browse the repository at this point in the history
  • Loading branch information
Elias-Graf authored Nov 18, 2024
1 parent 5a2d236 commit e40f579
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/app/components/dropdown/dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,11 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV

filled = computed(() => {
if (typeof this.modelValue() === 'string') return !!this.modelValue();
return this.label() !== 'p-emptylabel' && this.modelValue() !== undefined && this.modelValue() !== null;

const options = this.getAllVisibleAndNonVisibleOptions();
const isOptionSelected = options.findIndex((option) => this.isOptionValueEqualsModelValue(option)) !== -1;

return this.label() !== 'p-emptylabel' && isOptionSelected;
});

selectedOption: any;
Expand Down

0 comments on commit e40f579

Please sign in to comment.