I'm working in the Howtographql React + Apollo tut...
# orm-help
m
I'm working in the Howtographql React + Apollo tutorial. I'm on Filtering: Searching the List of Links section. When I implement the change to server/src/resolvers/Query.js I get a GraphQL error: Error: GraphQL error: Cannot read property 'query' of undefined. This error is captured at src/Components/LinkList.js:33. Reverting to the previous version of the
feed()
function in Query.js solves the error. Seems the problems is in this change:
Copy code
async function feed(parent, args, ctx, info) {
  const { filter, first, skip } = args // destructure input arguments
  const where = filter
    ? { OR: [{ url_contains: filter }, { description_contains: filter }] }
    : {}

  const queriedLinks = await ctx.db.query.links({ first, skip, where })

  return {
    linkIds: queriedLinks.map(link => link.id),
    count
  }
}
https://www.howtographql.com/react-apollo/7-filtering-searching-the-list-of-links/ This looks suspect to me. The original code queries Links as:
await context.prisma.links(...)
. While the new change queries links with:
await ctx.db.query.links(...)