baralecki
12 days agoContributor
Handlebars custom component not executing GraphQL query
I have been following along with the directions on this page to try to create a custom Handlebars component that executes a graphQL query and displays the results in simple HTML.
My .hbs file references the query like this:
{{#gql "privateUserStats" variables=(hash id=user.id)}}
...
{{/gql}}
I also have a .graphql query defined in queries/privateUserStats.query.graphql:
query privateUserStats($id: ID!) {
user(id: $id) {
id
login
firstName
lastName
... }
topicsStarted: messages(constraints: {authorId: {eq: $id}, depth: {eq: 0}}) {
totalCount
}...
}
and I reference it in my component.json under the "graphql" block:
"graphql": {
"privateUserStats": "./queries/privateUserStats.query.graphql"
}
Despite this setup:
The Handlebars rendered correctly
user.id was available
But the GraphQL query never fired — no network activity, no data returned, and no console errors
Can someone help? I'm all out of ideas.