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(wordpress-source-plugin): create nodes properly for images who exceed maxFileSizeBytes #31318

Merged
merged 22 commits into from
May 13, 2021

Conversation

veryspry
Copy link
Contributor

@veryspry veryspry commented May 7, 2021

Description

The WordPress source plugin was returning incorrectly formatted node data for page/post featuredImages whose size exceeded the maxFileSizeBytes config option. The result of this was that the featuredImage.node field would be set to null and not return other relevant info about the featured image.

This means that a query for allWpPost or allWpPage will no longer return this result:

"allWpPost": {
      "nodes": [
        {
          "id": "cG9zdDo1",
          "featuredImage": {
            // this isn't great because we don't know important info like at what url this resource can be found at
            "node": null
          }
        },
      ]
    }
"allWpPost": {
      "nodes": [
        { at
          "id": "cG9zdDo1",
          "featuredImage": {
            // now important node information is returned
            "node": {
              "id": "cG9zdDo2",
              "sourceUrl": "http://wordpresssite.com/wp-content/uploads/2021/05/picture-scaled.jpg",
              "localFile": null
            }
          }
        },
      ]
    }

Related Issues

Fixes #30755

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label May 7, 2021
@veryspry veryspry requested a review from TylerBarnes May 7, 2021 14:46
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.

Awesome work! 🙌 just a couple tiny changes then LGTM!

@TylerBarnes TylerBarnes 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 May 7, 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.

Looking awesome, just a few small things 😄

@TylerBarnes
Copy link
Contributor

@veryspry looks like the snapshots need to be updated. For these tests I usually just delete the snapshots and run the tests again since the test npm script is a bit awkward to run with --updateSnapshot

@veryspry
Copy link
Contributor Author

@veryspry looks like the snapshots need to be updated. For these tests I usually just delete the snapshots and run the tests again since the test npm script is a bit awkward to run with --updateSnapshot

Weird, I thought I already did that, but I must have changed the site structure to accommodate one of the most recent assertions 🤔

Anyways, snapshots have been updated!

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 great :D thanks again for this!

@TylerBarnes TylerBarnes merged commit dab650f into master May 13, 2021
@TylerBarnes TylerBarnes deleted the matt/fix-featured-image-node branch May 13, 2021 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: source-wordpress Related to Gatsby's integration with WordPress
Projects
None yet
2 participants