Open madeleineostoja opened 1 year ago
I'm trying to use query snippets/fragments exported from a shared lib to reduce boilerplate, but the codegen client throws the following error:
Error: Found unsupported source node type "Unknown" in reduceObjectStructures call. Please open an issue.
The basic shape of what I'm trying to do:
fragments.ts
export const asset = groq`'': asset->{url,extension}`;
query.ts
sanity( 'Home', groq`*[_id == "home"][0]{ ..., image { ${asset} } }` );
Removing the ${...} snippet fixes the issue.
Does the codegen client need to statically analyse the query? Because snippets like this work fine with the standard sanity client (not sure if it's common practice or not, I'm coming from a graphql background and was missing my fragments)
I'm trying to use query snippets/fragments exported from a shared lib to reduce boilerplate, but the codegen client throws the following error:
The basic shape of what I'm trying to do:
fragments.ts
query.ts
Removing the ${...} snippet fixes the issue.
Does the codegen client need to statically analyse the query? Because snippets like this work fine with the standard sanity client (not sure if it's common practice or not, I'm coming from a graphql background and was missing my fragments)