Gatsby: Using StaticQuery in html.js

Created on 14 Nov 2018  路  7Comments  路  Source: gatsbyjs/gatsby

Summary

I'm overriding html.js to add some data dynamically which I'm trying to get using GraphQL (using StaticQuery). Turns out it doesn't work, it compiles successfully and website opens up, but all it shows is this: Loading (StaticQuery). Is this a bug or html.js doesn't support StaticQuery?

Since StaticQuery is (or rather, should be) supported by any component (as mentioned here) and as html.js is a React component after all, can I know why html.js doesn't support it?

Relevant information

If you need any more relevant details, lemme know and I'll add them.

stale? question or discussion

Most helpful comment

@kakadiadarpan The docs doesn't say anywhere that the html.js doesn't support StaticQuery. Since the html.js is a React Component after all, it should be supporting StaticQuery as stated here:
image

Therefore, my original question still stands and I'd like this issue to be reopened.

All 7 comments

Why are you modifying the file?
And no, I most certainly think that GraphQL in general doesn鈥檛 work there. You can do everything with Gatsby鈥檚 APIs, there should be no need to modify this file.

Yeah. I'm just experimenting with it, to find its limits. Like, StaticQuery, does it not support it or is it a bug that's preventing it from working?

@k3rn31p4nic html.js doesn't support StaticQuery. Check the documentation for customizing html.js, it only does things mentioned there.

I'd just advise not to modify this file unless you absolutely have to.

@kakadiadarpan The docs doesn't say anywhere that the html.js doesn't support StaticQuery. Since the html.js is a React Component after all, it should be supporting StaticQuery as stated here:
image

Therefore, my original question still stands and I'd like this issue to be reopened.

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

Thanks for being a part of the Gatsby community! 馃挭馃挏

Hey again!

It鈥檚 been 30 days since anything happened on this issue, so our friendly neighborhood robot (that鈥檚 me!) is going to close it.

Please keep in mind that I鈥檓 only a robot, so if I鈥檝e closed this issue in error, I鈥檓 HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.

Thanks again for being part of the Gatsby community!

Was this page helpful?
0 / 5 - 0 ratings