GROQ: Reference fragment during processing

14 Views Asked by At

If I'm doing something like this:

export const pagesBySlugQuery = groq`
  *[_type == 'page' && slug.current == $slug][0]{
    _id,
    content[] {
      _type == 'some-dereferencable-thing' =>  {
        // *** HERE ***
      },
      // *** DEFAULT CASE ***
    }
  }
`;

At the part labeled *** HERE *** you're filtering objects in the content array. Is there an operator that can point to the actual object you're currently referring to? (Also, is there a way of adding a default case?)

Any help greatly appreciated! :)

0

There are 0 best solutions below