Skip to content

Commit

Permalink
Merge pull request #142 from vtex-apps/fix/autocomplete-loading-2x
Browse files Browse the repository at this point in the history
Fix searches with percentage
  • Loading branch information
thalytafabrine authored Jul 5, 2021
2 parents c47364c + c3836ef commit 74145ec
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed
- Autocomplete did not display products for search terms with percentage.

## [2.8.1] - 2021-06-29

### Added
Expand Down
33 changes: 23 additions & 10 deletions react/utils/pixel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,27 @@ export function handleAutocompleteSearch(
count: number,
term: string
) {
push({
event: EVENT_NAME,
eventType: EventType.Search,
search: {
operator,
misspelled,
text: decodeURI(term),
match: count,
},
})
try {
push({
event: EVENT_NAME,
eventType: EventType.Search,
search: {
operator,
misspelled,
text: decodeURI(term),
match: count,
},
})
} catch (e) {
push({
event: EVENT_NAME,
eventType: EventType.Search,
search: {
operator,
misspelled,
text: term,
match: count,
},
})
}
}

0 comments on commit 74145ec

Please sign in to comment.