Skip to content

Commit

Permalink
Merge pull request #505 from vtex-apps/feature/search-state
Browse files Browse the repository at this point in the history
Use searchState of the sessionStorage
  • Loading branch information
thalytafabrine authored Jan 28, 2021
2 parents b0f4137 + 480ef96 commit d39cc6a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
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]

### Changed
- Use `searchState` of the `sessionStorage` when it exists.

## [2.110.0] - 2020-12-11
### Added
- PDP critical CSS settings on schema.
Expand Down
6 changes: 5 additions & 1 deletion react/SearchContext.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ const SearchContext = ({

const queryValue = getCorrectQueryValue().replace(/\$2F/gi, '%2F')
const mapValue = queryField ? mapField : map
const state =
(typeof sessionStorage !== 'undefined' &&
sessionStorage.getItem('searchState')) ||
searchState

return (
<SearchQuery
Expand All @@ -103,7 +107,7 @@ const SearchContext = ({
includedPaymentSystems={includedPaymentSystems}
operator={operator}
fuzzy={fuzzy}
searchState={searchState}
searchState={state}
__unstableProductOriginVtex={__unstableProductOriginVtex}
>
{(searchQuery, extraParams) => {
Expand Down

0 comments on commit d39cc6a

Please sign in to comment.