Skip to content

Commit

Permalink
[DDW-620] Filter escaped valeus
Browse files Browse the repository at this point in the history
  • Loading branch information
thedanheller committed Apr 8, 2021
1 parent eb6479d commit 87069fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion source/skins/simple/OptionsSkin.js
Expand Up @@ -123,7 +123,6 @@ export const OptionsSkin = (props: Props) => {

const renderOption = option => {
const escapedSearchValue = escapeRegExp(searchValue) || '';
console.log('escapedSearchValue', escapedSearchValue);
// check if user has passed render prop "optionRenderer"
if (optionRenderer && isFunction(optionRenderer)) {
// call user's custom rendering logic
Expand Down
7 changes: 5 additions & 2 deletions stories/Select.stories.js
@@ -1,10 +1,14 @@
// @flow
import React from 'react';

// Pkgs
import { escapeRegExp } from 'lodash';

// storybook
import { storiesOf } from '@storybook/react';
import { withState } from '@dump247/storybook-state';
import { withKnobs, boolean } from '@storybook/addon-knobs';

// components
import { Select } from '../source/components/Select';
import { Modal } from '../source/components/Modal';
Expand Down Expand Up @@ -114,11 +118,10 @@ storiesOf('Select', module)
]}
hasSearch
onSearch={(searchValue: string, list: Array<any>) => {
const regex = new RegExp(searchValue, "i");
const regex = new RegExp(escapeRegExp(searchValue), "i");
return list
.filter((option) => {
const { label, value } = option;
const regex = new RegExp(searchValue, "i");
return regex.test(label) || regex.test(value);
})
.map((option) => {
Expand Down

0 comments on commit 87069fc

Please sign in to comment.