Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [2.140.0] - 2025-03-13
### Fixed

- Revert of "Added page, maxItemsPerPage and products to search metadata"

## [2.140.0] - 2025-03-13 [YANKED]

### Added

Expand Down
19 changes: 2 additions & 17 deletions react/SearchWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ interface SearchWrapperProps {
orderBy?: string
to?: number
page?: number
maxItemsPerPage?: number
CustomContext?: ComponentType
facetsLoading?: boolean
}
Expand All @@ -308,7 +307,6 @@ const SearchWrapper: FC<SearchWrapperProps> = props => {
CustomContext,
page: pageFromQuery = 0,
to,
maxItemsPerPage,
children,
} = props
const {
Expand Down Expand Up @@ -382,9 +380,7 @@ const SearchWrapper: FC<SearchWrapperProps> = props => {
department: searchQuery?.data
? getDepartmentMetadata(searchQuery.data)
: null,
search: searchQuery?.data
? getSearchMetadata(searchQuery.data, pageFromQuery, maxItemsPerPage)
: null,
search: searchQuery?.data ? getSearchMetadata(searchQuery.data) : null,
}

return [
Expand All @@ -394,18 +390,7 @@ const SearchWrapper: FC<SearchWrapperProps> = props => {
products,
},
]
}, [
searchQuery,
facetsLoading,
params,
account,
title,
orderBy,
map,
page,
pageFromQuery,
maxItemsPerPage,
])
}, [searchQuery, facetsLoading, params, account, title, orderBy, map, page])

const [hasLoaded, setHasLoaded] = useState(true)

Expand Down
15 changes: 1 addition & 14 deletions react/modules/searchMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,7 @@ export const getCategoryMetadata = (searchQuery?: SearchQueryData) => {
}
}

export const getSearchMetadata = (
searchQuery?: SearchQueryData,
page?: number,
maxItemsPerPage?: number
) => {
export const getSearchMetadata = (searchQuery?: SearchQueryData) => {
if (
!searchQuery ||
!searchQuery.productSearch ||
Expand All @@ -132,21 +128,12 @@ export const getSearchMetadata = (

const department = getDepartment(searchQuery)

const products = searchQuery?.products?.map(product => {
return {
productId: product.productId,
}
})

return {
term: decodedTerm || undefined,
category: department ? { id: department.id, name: department.name } : null,
results: searchQuery.productSearch.recordsFiltered,
operator: searchQuery.productSearch.operator,
searchState: searchQuery.productSearch.searchState,
correction: searchQuery.productSearch.correction,
products,
page,
maxItemsPerPage,
}
}
5 changes: 0 additions & 5 deletions react/modules/searchTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export interface SearchQueryData {
misspelled: boolean
}
}
products?: Product[]
facets?: Facets
}

Expand All @@ -45,10 +44,6 @@ export interface Breadcrumb {
href: string
}

export interface Product {
productId: string
}

export interface CategoriesTrees {
id: string
name: string
Expand Down
Loading