Skip to content

Commit

Permalink
Added check if engine filter is available
Browse files Browse the repository at this point in the history
  • Loading branch information
Renzo van Hootegem committed Sep 30, 2024
1 parent 16354b9 commit daf3e3c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/algolia-mesh/mesh/categories/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ import { getCategoryResults } from './getCategoryResults'
export const resolvers: Resolvers = {
Query: {
categories: async (root, args, context, info) => {
const todo = { algoliaCategories: true }
if (!todo.algoliaCategories) return context.m2.Query.categories({ root, args, context, info })
const isAgolia =
(args.filters?.categories_engine?.in ?? [args.filters?.categories_engine?.eq])[0] ===
'algolia'

if (!isAgolia) return context.m2.Query.categories({ root, args, context, info })
const algoliaResponse = await getCategoryResults(args, context, info)
const items: (CategoriesItemsItem | null)[] = []
const storeConfig = await getStoreConfig(context)
Expand Down

0 comments on commit daf3e3c

Please sign in to comment.