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(babel-plugin-remove-graphql-queries): Correct staticQueryDir default and improved Storybook support #38267

Merged
merged 4 commits into from
Jun 28, 2023

Conversation

dslovinsky
Copy link
Contributor

@dslovinsky dslovinsky commented Jun 26, 2023

Description

  • Fixes the static query directory to reflect where the data exists for newer versions of Gatsby
  • Always removes static queries for Storybook builds, which are necessary for Storybook component stories with static queries

Storybook is not able to process static queries in components, so the presence of any static queries will break Storybook builds. The solution for this in Gatsby's documentation is to add babel-plugin-remove-graphql-queries to Storybook's webpack config, however this won't work out of the box since the static data path defined in babel-plugin-remove-graphql-queries is out of date. It will also only run for when NODE_ENV = test even though for Storybook we want to run it all the time. This should help address issues like this one.

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jun 26, 2023
@LekoArts LekoArts added topic: GraphQL Related to Gatsby's GraphQL layer and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Jun 27, 2023
@LekoArts LekoArts changed the title fix(babel-plugin-remove-graphql-queries): fix static data path fix(babel-plugin-remove-graphql-queries): Correct staticQueryDir and improved Storybook support Jun 27, 2023
@LekoArts LekoArts changed the title fix(babel-plugin-remove-graphql-queries): Correct staticQueryDir and improved Storybook support fix(babel-plugin-remove-graphql-queries): Correct staticQueryDir default and improved Storybook support Jun 27, 2023
Copy link
Contributor

@LekoArts LekoArts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

@LekoArts LekoArts merged commit 2fd6623 into gatsbyjs:master Jun 28, 2023
@dslovinsky dslovinsky deleted the fix-static-query branch July 27, 2023 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: GraphQL Related to Gatsby's GraphQL layer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants