gatsby: Help with importing shadowed template component (query is not run)
Summary
I’ve only been working with themes a short while so it’s likely there is something I’m just not getting here.
The docs seem to indicate that importing shadowed components is OK. See Importing the shadowed component (Gatsby docs).
And yet when I import the component instead of copying it over, I’m not getting any data from the page query.
Possibly related?
- Theming: Page query in template is not shadowed #14611
- Shadowing templates doesn’t allow you to override the page query #16927
- (Both apparently fixed in https://github.com/gatsbyjs/gatsby/pull/17681)
Steps to reproduce
Go to this demo repo: https://github.com/laradevitt/demo-gatsby-shadow-template
See Issue #1 in the README for details on reproducing.
Thanks!
Environment
System:
OS: Windows 10 10.0.17763
CPU: (8) x64 Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
Binaries:
Node: 12.13.0 - ~\AppData\Local\Temp\yarn--1575659192406-0.508817745209361\node.CMD
Yarn: 1.19.1 - ~\AppData\Local\Temp\yarn--1575659192406-0.508817745209361\yarn.CMD
npm: 6.12.0 - C:\Program Files\nodejs\npm.CMD
Languages:
Python: 3.7.2 - /c/Users/r2dfoo/AppData/Local/Programs/Python/Python37/python
Browsers:
Edge: 44.17763.831.0
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (12 by maintainers)
I’ve also ran into the issue myself yesterday. Will let the @gatsbyjs/themes team know.
Confirming that the issue still exists in the demo repo with updated packages. Another workaround (but only if you are coming at this as a theme developer) is to remove the query name altogether from the component being shadowed; unique names will be generated for each query. Not very intuitive though! Especially given that importing the component doesn’t work. 🤷♀
Hi!
Plase provide a minimal reproduction that isn’t using Prismic’s source plugin but something like e.g. markdown files. I can see it working on my projects and it was added to the docs as it should work.
Thanks for using Gatsby! 💜
tested on macOS issue#1 not resolved.