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-source-wordpress): Add steps for refetch_ALL #33264

Merged
merged 7 commits into from Oct 19, 2021

Conversation

psharma-ii
Copy link
Contributor

@psharma-ii psharma-ii commented Sep 20, 2021

Description

REFETCH_ALL action_type implemented on WPGatsby was not being handled. This takes care of that by adding a conditional for REFETCH_ALL, sources the Node and checks if the sourceNode has refetchAll boolean set in addition to other Or conditionals. To add refetchAll GatsbyTypes was modified to add the new property.

Documentation

Where is this feature or API documented?
@gatsbyjs/documentation - Not sure where this is documented?

Related Issues

Link to the issue that is fixed by this PR (if there is one)
e.g. Fixes #33260

@TylerBarnes - Here's the change we talked about, I had to slightly change how I am calling sourceNodes method.

`REFETCH_ALL` action_type implemented on WPGatsby was not being handled. This takes care of that by adding a conditional for  `REFETCH_ALL`, sources the Node and checks if the sourceNode has `refetchAll` boolean set in addition to other Or conditionals.  To add `refetchAll` GatsbyTypes was modified to add the new property.
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Sep 20, 2021
@LekoArts LekoArts changed the title (fix) add steps for refetch_ALL fix(gatsby-source-wordpress): Add steps for refetch_ALL Sep 21, 2021
@LekoArts LekoArts added topic: source-wordpress Related to Gatsby's integration with WordPress and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Sep 21, 2021
Copy link
Contributor

@TylerBarnes TylerBarnes left a comment

Choose a reason for hiding this comment

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

Just one change, otherwise this looks great!

@@ -60,6 +61,9 @@ export const handleWpActions = async api => {
break
case `NON_NODE_ROOT_FIELDS`:
await fetchAndCreateNonNodeRootFields()
case `REFETCH_ALL`:
helpers.refetchAll = true;
await sourceNodes(helpers, {})
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for the delay here! I was out on vacation and had a lot of things to catch up on when I got back. Can we refactor this to not mutate helpers?

await sourceNodes({ ...helpers, refetchAll: true }, {})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@TylerBarnes - Thank you for getting back and no worries! Just made the change you requested and commited.

@TylerBarnes TylerBarnes self-requested a review October 18, 2021 21:25
TylerBarnes
TylerBarnes previously approved these changes Oct 18, 2021
Copy link
Contributor

@TylerBarnes TylerBarnes left a comment

Choose a reason for hiding this comment

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

Looks and works great :D thanks for this!! Looks like there are some linting issues but I'll use the Gatsby bot to fix that. Thanks again!

@TylerBarnes TylerBarnes added the bot: merge on green Gatsbot will merge these PRs automatically when all tests passes label Oct 18, 2021
@TylerBarnes
Copy link
Contributor

Looks like the failling tests are unrelated so I'm going to merge this. Thanks again for this awesome contribution! 🎉

@TylerBarnes TylerBarnes merged commit 4d8e40b into gatsbyjs:master Oct 19, 2021
@psharma-ii
Copy link
Contributor Author

@TylerBarnes - Happy to help, thanks for your help as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: merge on green Gatsbot will merge these PRs automatically when all tests passes topic: source-wordpress Related to Gatsby's integration with WordPress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trigger_Refetch_All not working.
3 participants