Skip to content

Commit ffc795a

Browse files
committed
Revert "Added page, maxItemsPerPage and products to search metadata (#595)"
This reverts commit f82ef19.
1 parent ea100d3 commit ffc795a

4 files changed

Lines changed: 7 additions & 36 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Revert of "Added page, maxItemsPerPage and products to search metadata"
13+
1014
## [2.140.0] - 2025-03-13
1115

1216
### Added

react/SearchWrapper.tsx

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ interface SearchWrapperProps {
287287
orderBy?: string
288288
to?: number
289289
page?: number
290-
maxItemsPerPage?: number
291290
CustomContext?: ComponentType
292291
facetsLoading?: boolean
293292
}
@@ -308,7 +307,6 @@ const SearchWrapper: FC<SearchWrapperProps> = props => {
308307
CustomContext,
309308
page: pageFromQuery = 0,
310309
to,
311-
maxItemsPerPage,
312310
children,
313311
} = props
314312
const {
@@ -382,9 +380,7 @@ const SearchWrapper: FC<SearchWrapperProps> = props => {
382380
department: searchQuery?.data
383381
? getDepartmentMetadata(searchQuery.data)
384382
: null,
385-
search: searchQuery?.data
386-
? getSearchMetadata(searchQuery.data, pageFromQuery, maxItemsPerPage)
387-
: null,
383+
search: searchQuery?.data ? getSearchMetadata(searchQuery.data) : null,
388384
}
389385

390386
return [
@@ -394,18 +390,7 @@ const SearchWrapper: FC<SearchWrapperProps> = props => {
394390
products,
395391
},
396392
]
397-
}, [
398-
searchQuery,
399-
facetsLoading,
400-
params,
401-
account,
402-
title,
403-
orderBy,
404-
map,
405-
page,
406-
pageFromQuery,
407-
maxItemsPerPage,
408-
])
393+
}, [searchQuery, facetsLoading, params, account, title, orderBy, map, page])
409394

410395
const [hasLoaded, setHasLoaded] = useState(true)
411396

react/modules/searchMetadata.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,7 @@ export const getCategoryMetadata = (searchQuery?: SearchQueryData) => {
103103
}
104104
}
105105

106-
export const getSearchMetadata = (
107-
searchQuery?: SearchQueryData,
108-
page?: number,
109-
maxItemsPerPage?: number
110-
) => {
106+
export const getSearchMetadata = (searchQuery?: SearchQueryData) => {
111107
if (
112108
!searchQuery ||
113109
!searchQuery.productSearch ||
@@ -132,21 +128,12 @@ export const getSearchMetadata = (
132128

133129
const department = getDepartment(searchQuery)
134130

135-
const products = searchQuery?.products?.map(product => {
136-
return {
137-
productId: product.productId,
138-
}
139-
})
140-
141131
return {
142132
term: decodedTerm || undefined,
143133
category: department ? { id: department.id, name: department.name } : null,
144134
results: searchQuery.productSearch.recordsFiltered,
145135
operator: searchQuery.productSearch.operator,
146136
searchState: searchQuery.productSearch.searchState,
147137
correction: searchQuery.productSearch.correction,
148-
products,
149-
page,
150-
maxItemsPerPage,
151138
}
152139
}

react/modules/searchTypes.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export interface SearchQueryData {
2222
misspelled: boolean
2323
}
2424
}
25-
products?: Product[]
2625
facets?: Facets
2726
}
2827

@@ -45,10 +44,6 @@ export interface Breadcrumb {
4544
href: string
4645
}
4746

48-
export interface Product {
49-
productId: string
50-
}
51-
5247
export interface CategoriesTrees {
5348
id: string
5449
name: string

0 commit comments

Comments
 (0)