New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
groq-builder projections on field #269
Labels
bug
Something isn't working
groq-builder
Related to the newer `groq-builder` package
invalid
This doesn't seem right
Comments
I am managing to work around this currently by doing this which is not really that good looking :) import { SectionsType, sectionsFragment } from "./../../lib/queries/sections.query";
import { q } from "@/lib/queries/groq-builder";
import { FragmentInputTypeTag, InferResultType } from "groq-builder";
// @ts-expect-error
export const pageQuery = q.star
.filterByType("page")
.filter("slug.current == $slug")
.slice(0)
.project({
title: true,
sections: q.raw<SectionsType[]>(`sections[]{
${sectionsFragment["[CONDITIONAL] [BY_TYPE]"].query}
}`),
});
export type PageQuery = InferResultType<typeof pageQuery>; |
The sample you posted does look correct! You've created a fragment with a conditional projection. This should be supported, here's the unit tests: Can you give me a little more detail on the errors you're experiencing? |
scottrippey
added
bug
Something isn't working
invalid
This doesn't seem right
groq-builder
Related to the newer `groq-builder` package
labels
May 1, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
groq-builder
Related to the newer `groq-builder` package
invalid
This doesn't seem right
Is there an existing issue for this?
Code of Conduct
Question
The text was updated successfully, but these errors were encountered: