Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search with null/undefined values breaks rendering #5140

Closed
joaomarcelofm opened this issue Jan 24, 2024 · 1 comment
Closed

Search with null/undefined values breaks rendering #5140

joaomarcelofm opened this issue Jan 24, 2024 · 1 comment
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@joaomarcelofm
Copy link

joaomarcelofm commented Jan 24, 2024

Describe the bug

When typing directly on the multi-select component, an error us thrown if any of the labels are null/undefined. There may be reasons for this (data-side), and, in our case, we're using slots to render something better for the user.

However, the error is thrown and causes the component to rerender or break fully.

Screen.Recording.2024-01-24.at.07.35.21.mov

Error:
image

The error happens here:

isOptionMatched: function isOptionMatched(option) {
      return this.isValidOption(option) && this.getOptionLabel(option).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale));
},

Reproducer

https://codesandbox.io/p/devbox/multi-select-filter-null-bug-s67hsy?file=%2Fsrc%2FApp.vue%3A10%2C28

PrimeVue version

3.45.0

Vue version

3.x

Language

TypeScript

Build / Runtime

Nuxt

Browser(s)

No response

Steps to reproduce the behavior

  1. Open the multi-select component
  2. Start typing random things directly (not on filter box)
  3. Error will appear

Expected behavior

Error is handled gracefully with the nullability of labels and doesn't break the rendering.

@joaomarcelofm joaomarcelofm added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jan 24, 2024
@mertsincan mertsincan added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jan 24, 2024
@mertsincan mertsincan added this to the 3.47.0 milestone Jan 24, 2024
@mertsincan
Copy link
Member

Thanks a lot for your report! We'll fix it asap.

@tugcekucukoglu tugcekucukoglu changed the title MultiSelect: search with null/undefined values breaks rendering Search with null/undefined values breaks rendering Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

3 participants