Skip to content
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(gatsby): remove redundant dispatch of query extraction error #28676

Merged
merged 2 commits into from
Dec 17, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions e2e-tests/mdx/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module.exports = {
path: `${__dirname}/src/posts`,
},
},
`gatsby-plugin-test-regression1`,
{
resolve: `gatsby-plugin-mdx`,
options: {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// See pages/regressions/index.mdx
exports.preprocessSource = args => args.contents
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "gatsby-plugin-test-regression1"
}
7 changes: 7 additions & 0 deletions e2e-tests/mdx/src/pages/regressions/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This is a regression test for query extraction bug in Gatsby.

All of the following is required to hit this bug:

1. There should be at least one other plugin implementing `preprocessSource`
2. This plugin must be listed before `gatsby-plugin-mdx` in `gatsby-config.js`
3. MDX file must contain word `graphql`
pieh marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 1 addition & 4 deletions packages/gatsby/src/query/file-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,7 @@ async function parseToAst(filePath, fileStr, { parentSpan, addError } = {}) {
ast = tmp
break
} catch (error) {
boundActionCreators.queryExtractionGraphQLError({
componentPath: filePath,
})
continue
// We emit the actual error below if every transpiled variant fails to parse
}
}
if (ast === undefined) {
Expand Down