Merge pull request #4472 from blockscout/vb-autocomplete-front-fix

Fix Cannot read property toLowerCase of undefined
pull/4473/head
Victor Baranov 3 years ago committed by GitHub
commit 0d6b7e4e92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 9
      apps/block_scout_web/assets/js/lib/autocomplete.js

@ -3,6 +3,7 @@
### Features ### Features
### Fixes ### Fixes
- [#4472](https://github.com/blockscout/blockscout/pull/4472) - Search autocomplete: Fix Cannot read property toLowerCase of undefined
- [#4456](https://github.com/blockscout/blockscout/pull/4456) - URL encoding for NFT media files URLs - [#4456](https://github.com/blockscout/blockscout/pull/4456) - URL encoding for NFT media files URLs
- [#4453](https://github.com/blockscout/blockscout/pull/4453) - Unescape characters for string output type in the contract response - [#4453](https://github.com/blockscout/blockscout/pull/4453) - Unescape characters for string output type in the contract response
- [#4401](https://github.com/blockscout/blockscout/pull/4401) - Fix displaying of token holders with the same amount - [#4401](https://github.com/blockscout/blockscout/pull/4401) - Fix displaying of token holders with the same amount

@ -43,9 +43,12 @@ const resultsListElement = (list, data) => {
fetchTextAdData() fetchTextAdData()
} }
const searchEngine = (query, record) => { const searchEngine = (query, record) => {
if (record.name.toLowerCase().includes(query.toLowerCase()) || if (record && (
record.symbol.toLowerCase().includes(query.toLowerCase()) || (record.name && record.name.toLowerCase().includes(query.toLowerCase())) ||
record.contract_address_hash.toLowerCase().includes(query.toLowerCase())) { (record.symbol && record.symbol.toLowerCase().includes(query.toLowerCase())) ||
(record.contract_address_hash && record.contract_address_hash.toLowerCase().includes(query.toLowerCase()))
)
) {
var searchResult = `${record.contract_address_hash}<br/>` var searchResult = `${record.contract_address_hash}<br/>`
if (record.type === 'label') { if (record.type === 'label') {
searchResult += `<div class="fontawesome-icon tag"></div><span> <b>${record.name}</b></span>` searchResult += `<div class="fontawesome-icon tag"></div><span> <b>${record.name}</b></span>`

Loading…
Cancel
Save