diff --git a/storefront/components/Pages/Search/SearchContent.tsx b/storefront/components/Pages/Search/SearchContent.tsx index 7502a3aceb..7ceb01fc1f 100644 --- a/storefront/components/Pages/Search/SearchContent.tsx +++ b/storefront/components/Pages/Search/SearchContent.tsx @@ -2,7 +2,6 @@ import { ProductsSearch } from './ProductsSearch'; import { Heading } from 'components/Basic/Heading/Heading'; import { SimpleNavigation } from 'components/Blocks/SimpleNavigation/SimpleNavigation'; import { SkeletonPageProductsList } from 'components/Blocks/Skeleton/SkeletonPageProductsList'; -import { Webline } from 'components/Layout/Webline/Webline'; import { SearchQueryApi, SimpleCategoryFragmentApi } from 'graphql/generated'; import { mapConnectionEdges } from 'helpers/mappers/connection'; import { getStringFromUrlQuery } from 'helpers/parsing/urlParsing'; @@ -30,7 +29,7 @@ export const SearchContent: FC = ({ searchResults, fetching const isFetchingInitialData = !searchResults && fetching; return ( - + <> {`${t('Search results for')} "${getStringFromUrlQuery(router.query.q)}"`} {isFetchingInitialData ? ( @@ -69,6 +68,6 @@ export const SearchContent: FC = ({ searchResults, fetching ) )} - + ); }; diff --git a/storefront/pages/search.tsx b/storefront/pages/search.tsx index a0d6d72625..c0036579c1 100644 --- a/storefront/pages/search.tsx +++ b/storefront/pages/search.tsx @@ -1,6 +1,7 @@ import { MetaRobots } from 'components/Basic/Head/MetaRobots'; import { getEndCursor } from 'components/Blocks/Product/Filter/helpers/getEndCursor'; import { CommonLayout } from 'components/Layout/CommonLayout'; +import { Webline } from 'components/Layout/Webline/Webline'; import { SearchContent } from 'components/Pages/Search/SearchContent'; import { DEFAULT_PAGE_SIZE } from 'config/constants'; import { @@ -43,11 +44,12 @@ const SearchPage: FC = () => { const [{ data: searchData, fetching }] = useSearchQueryApi({ variables: { - search: searchString ?? '', + search: searchString!, orderingMode: sort, filter: mapParametersFilter(filter), pageSize: DEFAULT_PAGE_SIZE * (currentLoadMore + 1), }, + pause: !searchString, }); const [searchUrl] = getInternationalizedStaticUrls(['/search'], url); @@ -62,7 +64,15 @@ const SearchPage: FC = () => { <> - + + {searchString ? ( + + ) : ( +
+ {t('There are no results as you have searched with an empty query...')} +
+ )} +
); @@ -84,27 +94,29 @@ export const getServerSideProps = getServerSidePropsWrapper(({ redisClient, doma return initServerSideProps({ context, - prefetchedQueries: [ - { - query: SearchQueryDocumentApi, - variables: { - search, - orderingMode, - filter, - pageSize: DEFAULT_PAGE_SIZE * (loadMore + 1), - }, - }, - { - query: SearchProductsQueryDocumentApi, - variables: { - search, - orderingMode, - filter, - endCursor: getEndCursor(page), - pageSize: DEFAULT_PAGE_SIZE * (loadMore + 1), - }, - }, - ], + prefetchedQueries: !search + ? [] + : [ + { + query: SearchQueryDocumentApi, + variables: { + search, + orderingMode, + filter, + pageSize: DEFAULT_PAGE_SIZE * (loadMore + 1), + }, + }, + { + query: SearchProductsQueryDocumentApi, + variables: { + search, + orderingMode, + filter, + endCursor: getEndCursor(page), + pageSize: DEFAULT_PAGE_SIZE * (loadMore + 1), + }, + }, + ], redisClient, domainConfig, t, diff --git a/storefront/public/locales/cs/common.json b/storefront/public/locales/cs/common.json index 113986b96c..82288225bf 100644 --- a/storefront/public/locales/cs/common.json +++ b/storefront/public/locales/cs/common.json @@ -360,6 +360,7 @@ "The transport you selected is no longer available.": "Doprava, kterou jste si zvolili, již není dostupná.", "There are no products in the shared wishlist.": "Sdílený seznam oblíbených produktů je prázdný.", "There are no products in the wishlist. Add some first.": "Seznam oblíbených produktů je prázdný. Nejprve přidejte nějaké produkty do oblíbených.", + "There are no results as you have searched with an empty query...": "Vaše vyhledávání nevrátilo žádné výsledky, protože jste nezadali žádný dotaz...", "There was an error while adding a promo code to the order.": "Během přidávání slevového kupónu do objednávky se vyskytla chyba.", "There was an error while changing your password": "Při změně Vašeho hesla došlo k chybě", "There was an error while deleting your delivery address": "Při mazání dodací adresy došlo k chybě", diff --git a/storefront/public/locales/en/common.json b/storefront/public/locales/en/common.json index 358f13de1d..136797df18 100644 --- a/storefront/public/locales/en/common.json +++ b/storefront/public/locales/en/common.json @@ -346,6 +346,7 @@ "The transport you selected is no longer available.": "The transport you selected is no longer available.", "There are no products in the shared wishlist.": "There are no products in the shared wishlist.", "There are no products in the wishlist. Add some first.": "There are no products in the wishlist. Add some first.", + "There are no results as you have searched with an empty query...": "There are no results as you have searched with an empty query...", "There was an error while adding a promo code to the order.": "There was an error while adding a promo code to the order.", "There was an error while changing your password": "There was an error while changing your password", "There was an error while deleting your delivery address": "There was an error while deleting your delivery address", diff --git a/storefront/public/locales/sk/common.json b/storefront/public/locales/sk/common.json index 1baa3fef52..b1b3c4dd06 100644 --- a/storefront/public/locales/sk/common.json +++ b/storefront/public/locales/sk/common.json @@ -360,6 +360,7 @@ "The transport you selected is no longer available.": "The transport you selected is no longer available.", "There are no products in the shared wishlist.": "Zdieľaný zoznam obľúbených produktov je prázdny.", "There are no products in the wishlist. Add some first.": "Zoznam obľúbených produktov je prázdny. Najskôr pridajte niektoré produkty do svojich obľúbených.", + "There are no results as you have searched with an empty query...": "Vaše vyhľadávanie neprinieslo žiadne výsledky, pretože ste nezadali žiadny dotaz...", "There was an error while adding a promo code to the order.": "Behom pridávania zľavového kupónu do objednávky sa vyskytla chyba.", "There was an error while changing your password": "Pri zmene Vášho hesla došlo k chybe ", "There was an error while deleting your delivery address": "Pri mazaní dodacej adresy došlo k chybe",