-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(static-query): Use @babel/traverse for traversing algorithm #10443
fix(static-query): Use @babel/traverse for traversing algorithm #10443
Conversation
Thanks! We should probably also change the dependency in |
We could also update https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/bootstrap/resolve-module-exports.js (only other place where we import
We already have One thing that could be helpful is to adjust (or add new test) for checking correctness of StaticQuery extraction if its inside |
And btw - Awesome job on figuring this one out - it looks like really fringe issue to debug |
Thanks @pieh :) I'll make those changes and update the PR shortly. |
542fcfb
to
7760d23
Compare
Woah! Thanks for reaching deep and finding this! 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verified locally and works as advertised - once again - awesome debugging to figure this one out! Thanks @victor-cordova!
Holy buckets, @victor-cordova — we just merged your PR to Gatsby! 💪💜 Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! |
* master: (33 commits) fix(blog): youfit case study typofix Doc improvements to Visual testing with Storybook guide (gatsbyjs#10436) fix(gatsby-plugin-offline): prevent incorrect revisioning of static file by workbox (gatsbyjs#10416) fix(starters): ttag repo link fix typo in pull request template (gatsbyjs#10454) fix(www) Fix query for plugin links always ?=undefined (gatsbyjs#10453) chore(release): Publish fix(gatsby): fix extracting StaticQuery nested in shorthand fragment (gatsbyjs#10443) fix(www): avoid querying for no-cache=1 (gatsbyjs#10389) fix(gatsby-image): update typescript definitions - properly mark fields as optional (gatsbyjs#10419) refactor(gatsby): improve EnsureResources (gatsbyjs#10224) Fixed minor Typos and grammatical errors (gatsbyjs#9353) docs: add ClinciJS website into showcase (gatsbyjs#10437) docs(babel-preset-gatsby): document --save-dev flag in README (gatsbyjs#10434) fix(docs): Environment Variables Examples (gatsbyjs#10406) chore(release): Publish [gatsby-image] re: fade out base64 on full image load (gatsbyjs#7539) docs(starter-library): add example to starter library (gatsbyjs#10425) docs(gatsby-plugin-offline): specify to not HTTP-cache sw.js (gatsbyjs#10430) fix(docs): prompt => confirm (gatsbyjs#10431) ...
* master: feat(www): add unbird feedback component to starter lib (gatsbyjs#10450) fix(blog): youfit case study typofix Doc improvements to Visual testing with Storybook guide (gatsbyjs#10436) fix(gatsby-plugin-offline): prevent incorrect revisioning of static file by workbox (gatsbyjs#10416) fix(starters): ttag repo link fix typo in pull request template (gatsbyjs#10454) fix(www) Fix query for plugin links always ?=undefined (gatsbyjs#10453) chore(release): Publish fix(gatsby): fix extracting StaticQuery nested in shorthand fragment (gatsbyjs#10443)
* master: (1037 commits) Update starters.yml (gatsbyjs#10505) chore(release): Publish fix(graphql-skip-limit): fix hasNextPage (gatsbyjs#10504) chore: use cjs instead of esm for consistency (gatsbyjs#10494) feat(gatsby-remark-copy-linked-files): add support for video elements with `src` attribute (gatsbyjs#10395) typofix (gatsbyjs#10488) Add kobit.in to showcase (gatsbyjs#10496) fix(docs): window.reload => window.location.reload (gatsbyjs#10459) feat(www): add unbird feedback component to starter lib (gatsbyjs#10450) fix(blog): youfit case study typofix Doc improvements to Visual testing with Storybook guide (gatsbyjs#10436) fix(gatsby-plugin-offline): prevent incorrect revisioning of static file by workbox (gatsbyjs#10416) fix(starters): ttag repo link fix typo in pull request template (gatsbyjs#10454) fix(www) Fix query for plugin links always ?=undefined (gatsbyjs#10453) chore(release): Publish fix(gatsby): fix extracting StaticQuery nested in shorthand fragment (gatsbyjs#10443) fix(www): avoid querying for no-cache=1 (gatsbyjs#10389) fix(gatsby-image): update typescript definitions - properly mark fields as optional (gatsbyjs#10419) refactor(gatsby): improve EnsureResources (gatsbyjs#10224) ...
Hello 👋 , this PR fixes #10016.
Summary
After digging deep into the rabbit hole of the traversal algorithm in
/packages/gatsby/src/internal-plugins/query-runners/file-parser.js
, I found out that the traversing algorithm wasn't taking into account the ast nodes of type JSXFragment. Internally, this is because considered in the babel-types version used by babel-traverse v6.26. Therefore, I am using now the more updated @babel/traverse which is a dependency this package already had.Test code
I created a simple
gatsby new gastsby-test
and created a index with the following codeThen, tested it out with before the changes (displaying loading forever) and after the changes (displays correct text). It works fine and tests are still passing 😄
Let me know if you have any comments
Cheers