Skip to content

Commit

Permalink
ignore ' in filter search
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-luger committed Sep 19, 2024
1 parent d195f79 commit 9e2f376
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions components/Flipper/FlipRestrictionList/FlipRestrictionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ function FlipRestrictionList(props: Props) {
function getRestrictionsFilteredBySearch(restrictions: FlipRestriction[], invert = false) {
return restrictions.filter(restriction => {
let isValid = false
let lowerCaseSearchText = searchText.toLowerCase().replace(/_/g, ' ')
if (restriction.item?.name && restriction.item?.name.toLowerCase().includes(lowerCaseSearchText)) {
let lowerCaseSearchText = searchText.toLowerCase().replace(/_/g, ' ').replace(/'/g, '')
if (restriction.item?.name && restriction.item?.name?.replace(/'/g, '').toLowerCase().includes(lowerCaseSearchText)) {
isValid = true
}
if (restriction.itemFilter && !isValid) {
Expand All @@ -313,8 +313,8 @@ function FlipRestrictionList(props: Props) {
return
}
let keyWithColon = `${key}:`
let keyWithoutUnderscore = keyWithColon.replace(/_/g, ' ')
let valueWithoutUnderScore = restriction.itemFilter![key].toString().replace(/_/g, ' ')
let keyWithoutUnderscore = keyWithColon.replace(/_/g, ' ').replace(/'/g, '')
let valueWithoutUnderScore = restriction.itemFilter![key].toString().replace(/_/g, ' ').replace(/'/g, '')
if (
restriction.itemFilter![key].toString().toLowerCase().includes(lowerCaseSearchText) ||
valueWithoutUnderScore.toLowerCase().includes(lowerCaseSearchText) ||
Expand All @@ -325,7 +325,7 @@ function FlipRestrictionList(props: Props) {
}
})
}
if (restriction.tags && restriction.tags.findIndex(tag => tag.toLowerCase().includes(lowerCaseSearchText)) !== -1 && !isValid) {
if (restriction.tags && restriction.tags.findIndex(tag => tag.toLowerCase()?.replace(/'/g, '').includes(lowerCaseSearchText)) !== -1 && !isValid) {
isValid = true
}
if (invert) {
Expand Down

0 comments on commit 9e2f376

Please sign in to comment.