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

fix the error while passing any data except string for normalization #868

Merged
merged 2 commits into from
Oct 10, 2022

Conversation

atiqueahmedziad
Copy link
Contributor

@atiqueahmedziad atiqueahmedziad commented Oct 4, 2022

Description

When using a <Facet isFilterable={true} /> on a field mapped to NUMBER, we get the following error:
Uncaught TypeError: str.normalize is not a function

List of changes

  1. If anything other than string passed as argument in accentFold function, it should return empty string.
  2. Added a shield for facet values to be string.

Associated Github Issues

Fixes #833

.toLowerCase()
.includes(accentFold(searchTerm).toLowerCase())
typeof option.value === "string"
? accentFold(option.value)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found that option.value is not always string. Especially, when using a <Facet isFilterable={true} /> on a field like date_established, it becomes an object.

@atiqueahmedziad atiqueahmedziad force-pushed the fix-normalize branch 2 times, most recently from 093eaec to 0e0c448 Compare October 4, 2022 18:18
@atiqueahmedziad
Copy link
Contributor Author

@JasonStoltz @joemcelroy review?

@joemcelroy
Copy link
Member

thanks for the PR @atiqueahmedziad! Will review later on today.

@joemcelroy joemcelroy self-requested a review October 10, 2022 10:38
Copy link
Member

@joemcelroy joemcelroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks for your submission,

@joemcelroy joemcelroy merged commit ab55cb4 into elastic:master Oct 10, 2022
@joemcelroy
Copy link
Member

this was released under v1.18.1 🎉

joemcelroy added a commit to joemcelroy/search-ui that referenced this pull request Jan 10, 2023
…lastic#868)

Co-authored-by: Joseph McElroy <joseph.mcelroy@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

isFilterable={true} breaks when searching on a number
2 participants