Skip to content

Commit

Permalink
Merge pull request #648 from vtex-apps/bugfix/search-result-ssr
Browse files Browse the repository at this point in the history
Fix search-result ssr
  • Loading branch information
hiagolcm authored Dec 7, 2023
2 parents bc13354 + cb79f8d commit 0b8e10b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 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
- Search result ssr

## [3.128.0] - 2023-11-28

### Added
Expand Down
6 changes: 2 additions & 4 deletions react/components/SearchQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import useSession from '../hooks/useSession'

function getCookie(cname) {
if (!canUseDOM) {
return null
return undefined
}

const name = `${cname}=`
Expand All @@ -39,7 +39,7 @@ function getCookie(cname) {
}
}

return ''
return undefined
}

const DEFAULT_PAGE = 1
Expand Down Expand Up @@ -197,8 +197,6 @@ const useQueries = (
const isLazyFacetsFetchEnabled = settings?.enableFiltersFetchOptimization

const productSearchResult = useQuery(productSearchQuery, {
ssr: false,
skip: !canUseDOM,
variables: {
...variables,
variant: getCookie('sp-variant'),
Expand Down

0 comments on commit 0b8e10b

Please sign in to comment.