From b50ea644490a34369c183bba66e50ecca7c8e243 Mon Sep 17 00:00:00 2001 From: Onuwa Nnachi Isaac Date: Fri, 13 Sep 2019 01:16:20 +0100 Subject: [PATCH] Fix search logic --- src/common/components/Search/Search.jsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/common/components/Search/Search.jsx b/src/common/components/Search/Search.jsx index d786c99..a08b144 100644 --- a/src/common/components/Search/Search.jsx +++ b/src/common/components/Search/Search.jsx @@ -19,7 +19,13 @@ class Search extends React.Component { const { value } = e.target const { dappState } = this.props if (value.length > 1) { - const dapps = dappState.dapps.filter(dapp => dapp.name.startsWith(value)) + const searchExp = new RegExp(value, 'i') + const dapps = dappState.dapps.filter(dapp => { + if (dapp.name.search(searchExp) != -1) { + return dapp + } + return null + }) this.setState({ dapps, isSearching: true }) } else if (value === '') { this.setState({