Open paulpopus opened 2 years ago
This would be huge. Currently I can only execute my simple queries, but many of them are built with partial imports for reuse.
Thanks for reporting. We recently released a new version of this extension. Could you verify if your issue is fixed by upgrading?
@runeb I'm still seeing this error on 0.2.0.
Example code:
const image = groq`
"image": image{
...,
"asset": asset->,
}
`;
const CONTACT_US_PAGE = groq`
*[_id == 'contactUsPage'][0]{
...,
${image}
}`;
When concatenating another string into the query, the preview isn't able to handle this and throws an error instead:
Example code:
This issue is consistent when using groq as a function:
And variations of comments so far in my testing.
The image query being another completely valid query template literal string, I assume this is to do with the syntax
${}
conflicting with the query object syntax but not entirely sure.The error is a syntax error
I tried escaping this as well but that didn't work.
Why this would be useful:
String concatenation is useful for re-using object queries where you have multiple references or objects that are going to be the same, in this example we always want to project the image asset in the same way across every document.
What should happen:
String is concatenated into the query without any issues.
Note that you can run these queries just fine with the fetch client, it just affects this extension's preview.