mirror of
https://github.com/vercel/commerce.git
synced 2025-07-27 04:01:23 +00:00
fix to category search
This commit is contained in:
@@ -42,10 +42,13 @@ export default function Search({ categories, brands }: SearchPropsType) {
|
||||
|
||||
const { pathname, category, brand } = useSearchMeta(asPath)
|
||||
const activeCategory = categories.find((cat: any) => cat.slug === category)
|
||||
|
||||
|
||||
const activeBrand = brands.find(
|
||||
(b: any) => getSlug(b.node.path) === `brands/${brand}`
|
||||
)?.node
|
||||
|
||||
|
||||
const { data } = useSearch({
|
||||
search: typeof q === 'string' ? q : '',
|
||||
categoryId: activeCategory?.id,
|
||||
|
Reference in New Issue
Block a user