Skip to content

Commit

Permalink
bugfix selectedOptions not taking into account all options sometimes (#…
Browse files Browse the repository at this point in the history
…17734)

Co-authored-by: Jacob Siegle <[email protected]>
  • Loading branch information
JacobSiegle and Jacob Siegle authored Feb 21, 2025
1 parent 41bccc6 commit 361d315
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/primeng/src/multiselect/multiselect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1333,10 +1333,10 @@ export class MultiSelect extends BaseComponent implements OnInit, AfterViewInit,
effect(() => {
const modelValue = this.modelValue();

const visibleOptions = this.visibleOptions();
if (visibleOptions && isNotEmpty(visibleOptions)) {
const allVisibleAndNonVisibleOptions = this.getAllVisibleAndNonVisibleOptions();
if (allVisibleAndNonVisibleOptions && isNotEmpty(allVisibleAndNonVisibleOptions)) {
if (this.optionValue && this.optionLabel && modelValue) {
this.selectedOptions = visibleOptions.filter((option) => modelValue.includes(option[this.optionLabel]) || modelValue.includes(option[this.optionValue]));
this.selectedOptions = allVisibleAndNonVisibleOptions.filter((option) => modelValue.includes(option[this.optionLabel]) || modelValue.includes(option[this.optionValue]));
} else {
this.selectedOptions = modelValue;
}
Expand Down

0 comments on commit 361d315

Please sign in to comment.